Matlab Server Error

MATLAB-specific help discussions.

Matlab Server Error

Postby smdrake » Thu May 19, 2011 8:18 pm

My colleague and I are running into another issue with the MatlabtoGMAT example. We both tried to enter other Matlab examples to run GMAT but an error saying Matlab server is not open, continually popped up. We went over the MatlabtoGmat procedure on the main page and once again were stuck when it came to the Matlab Server. It seems in the GMAT Resource Tree that the matlab interface is not an option. Was this removed from the program?

Can anyone shed any light on this matter?
Posts: 9
Joined: Thu May 19, 2011 5:02 pm

Re: Matlab Server Error

Postby jjkparker » Thu May 19, 2011 9:33 pm


Are you using the R2011a release from Sourceforge? If so, there are a few steps that need to happen to enable Matlab integration:

First, the Matlab plugin comes disabled by default. In your GMAT installation directory, inside the bin folder, there's a file called gmat_startup_file.txt. Uncomment this line by removing the # symbol:

Code: Select all
PLUGIN                 = ../plugins/libMatlabInterface

(You can also uncomment the libFminconOptimizer line if you have the Optimization Toolbox installed.)

That should at least get you to see "Matlab" and "Matlab Server" entries in the Resource Tree.

Next, you'll need to set up Matlab in your system path:

  • Edit your system path by going to Control Panel > System and Security > System > Advanced system settings. Then click the Environment Variables... button and highlight the Path variable in the bottom section of the window. Click "Edit..."
  • You'll need to find the parts of the Path that relate to the version of Matlab you want to use and move them to the beginning (remembering to separate them with semicolons). Then add a new variable, also to the beginning: <Matlab path>\bin\win32, where <Matlab path> is the path to your Matlab installation.
  • If the version of Matlab you want to use isn't the latest that was installed, you'll need to run matlab -regserver as an administrator.

Phew! Let me know if there is any confusion about this. At least you only need to do it once!
Joel J. K. Parker
Flight dynamics engineer, GMAT team
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Matlab Server Error

Postby teubert » Sun May 22, 2011 6:11 pm

I tried uncommenting the line "PLUGIN = ../plugins/libMatlabInterface" in the gmat_startup_file.txt file and the MatlabInterface is still not showing up under the interfaces folder in the system tree. I checked the GmatLog.txt file and gave the error
Code: Select all
*** Library "..\plugins\libMatlabInterface" did not open.
*** Unable to load the dynamic library "..\plugins\libMatlabInterface"

I tried reinstalling gmat and restarting the computer but it didn't help. I'm still getting the same error.
Are there any other things that I should try to have this work?


*EDIT: added error info
Posts: 5
Joined: Thu May 19, 2011 5:12 pm
Location: Ames, IA

Re: Matlab Server Error

Postby jbaldwin11 » Mon May 23, 2011 11:45 pm

I too am getting the same error when I open GMAT:

***Unable to load the dynamic libray "..\plugins\libMatlabInterface"

To complicate things, I am trying to use MATLAB 64-bit, could this be causing the problem. I have the MATLAB interface working perfectly with MATLAB 32-bit. Any help would be appreciated.

- Jason
Posts: 2
Joined: Thu Jun 17, 2010 6:06 pm

Re: Matlab Server Error

Postby DJCinSB » Tue May 24, 2011 8:31 pm

The calls into 64-bit MATLAB libraries are different from the calls into the 32-bit libraries because of differences in pointer sizes, so if you are using the released build of GMAT (32-bit), you definitely also need to be using the 32-bit version of the MATLAB libraries. The MathWorks does let you install both 32- and 64-bit versions on the same (64-bit) machine -- the install files for 32-bit are in a subdirectory of the DVD. If you install both, you'll need to be sure that GMAT finds the 32-bit libraries first in your path.

GMAT can be built 64-bit using Visual Studio, but that version isn't tested and therefore wasn't part of the R2011a release.

I hope that helps explain what's going on here. I can help with setup if you want to try building the 64-bit version of GMAT.
Posts: 274
Joined: Mon Jun 09, 2008 3:57 pm

Re: Matlab Server Error

Postby jbaldwin11 » Tue May 24, 2011 8:46 pm

Thanks for the help. I figured it was 64-bit biting me. For now, I'll be content to operate in 32-bit land, but good to know there is the option to push GMAT to 64-bit.
Posts: 2
Joined: Thu Jun 17, 2010 6:06 pm

Return to MATLAB Help

Who is online

Users browsing this forum: No registered users and 2 guests