Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to choose the MATLAB version that ran by "COMSOL 4.2 with MATLAB"?

Please login with a confirmed email address before reporting spam

Hello all,

I have two versions of MATLAB on my computer, R2010a and R2011b. When I launch the COMSOL 4.2 with MATLAB shortcut (C:\COMSOL42\bin\win64\comsolserver.exe matlab), R2010a is launched. I am wondering if there is a way to let this shortcut and LiveLink run R2011b instead of R2010a.

Thanks.

Best,
Kan

7 Replies Last Post 08.05.2012, 18:26 GMT-4
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13.02.2012, 16:45 GMT-5
Hi

Check the KB (Knowledge Base) on the main COMSOL web site, there is some explanations there

--
Good luck
Ivar
Hi Check the KB (Knowledge Base) on the main COMSOL web site, there is some explanations there -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13.02.2012, 16:54 GMT-5
Thank you Ivar. Sorry for failing to find the following KB article earlier.

For anyone that might be interested, I copied the article for you:

www.comsol.no/support/knowledgebase/1113/

Solution Number: 1113
Title: COMSOL does not start with the latest MATLAB version
Platform:
Applies to: LiveLink™ for MATLAB®
Versions: 4.2
Created: April 14, 2011
Last Modified: May 27, 2011
Categories:
Keywords:
Problem Description
I have installed a new MATLAB version, but running COMSOL with MATLAB keeps opening the older version of MATLAB.

Solution
You need to manually update the MATLAB root directory path:

Use a text editor to edit the files comsolserver.ini and comsol.ini located in the COMSOL installation directory:

installdir\COMSOL42\bin\archdir

where installdir is your local COMSOL root directory and archdir is your architecture directory, for example win64. In both files, update the MATLAB root directory path, in the line starting

-Dcs.mlroot=

Please verify the COMSOL Livelink for MATLAB system requirements to ensure the compatibility between the programs.

See also:

MATLAB function calls fail (kb 1093)
Thank you Ivar. Sorry for failing to find the following KB article earlier. For anyone that might be interested, I copied the article for you: http://www.comsol.no/support/knowledgebase/1113/ Solution Number: 1113 Title: COMSOL does not start with the latest MATLAB version Platform: Applies to: LiveLink™ for MATLAB® Versions: 4.2 Created: April 14, 2011 Last Modified: May 27, 2011 Categories: Keywords: Problem Description I have installed a new MATLAB version, but running COMSOL with MATLAB keeps opening the older version of MATLAB. Solution You need to manually update the MATLAB root directory path: Use a text editor to edit the files comsolserver.ini and comsol.ini located in the COMSOL installation directory: installdir\COMSOL42\bin\archdir where installdir is your local COMSOL root directory and archdir is your architecture directory, for example win64. In both files, update the MATLAB root directory path, in the line starting -Dcs.mlroot= Please verify the COMSOL Livelink for MATLAB system requirements to ensure the compatibility between the programs. See also: MATLAB function calls fail (kb 1093)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 02.05.2012, 05:15 GMT-4
I have a similar problem regarding COMSOL with Matlab.

I use Matlab 2010b Win64.
Consequently, the matlab.exe is located at:
C:\Program Files\MATLAB\R2010b\bin\win64

When I execute
"C:\Program Files\COMSOL\COMSOL42a\bin\win64\comsolserver.exe" matlab
there is not the right path chosen to execute Matlab.

The log tells me:
00001:349 ERROR Exception:
com.comsol.util.exceptions.FlException: Could not find matlab at X#C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe
Messages:
Could not find matlab at X#C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe
[com.comsol.logger]

Changing the root directory doesn't make sense, since it is the incorrect sub-directory which COMSOL is using.

Any help ?
Thank you very much.
I have a similar problem regarding COMSOL with Matlab. I use Matlab 2010b Win64. Consequently, the matlab.exe is located at: C:\Program Files\MATLAB\R2010b\bin\win64 When I execute "C:\Program Files\COMSOL\COMSOL42a\bin\win64\comsolserver.exe" matlab there is not the right path chosen to execute Matlab. The log tells me: 00001:349 ERROR Exception: com.comsol.util.exceptions.FlException: Could not find matlab at X#C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe Messages: Could not find matlab at X#C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe [com.comsol.logger] Changing the root directory doesn't make sense, since it is the incorrect sub-directory which COMSOL is using. Any help ? Thank you very much.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 02.05.2012, 20:10 GMT-4
Hi Franz,

Just use an editor to open "comsolserver.ini". The path is:

C:\COMSOL42\bin\win64\comsolserver.ini

Your path may be different.

And edit the line starting with "-Dcs.mlroot" as follows:

-Dcs.mlroot=C:\Program Files\MATLAB\R2010b

Then you will be fine.

Best,
Kan
Hi Franz, Just use an editor to open "comsolserver.ini". The path is: C:\COMSOL42\bin\win64\comsolserver.ini Your path may be different. And edit the line starting with "-Dcs.mlroot" as follows: -Dcs.mlroot=C:\Program Files\MATLAB\R2010b Then you will be fine. Best, Kan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 08.05.2012, 02:36 GMT-4
Thank you Kan for your advice.

Unfortunately this doesn't work as I am using Matlab Win64.
Comsol tries to execute Matlab Win32. And consequently Comsol is trying to open
C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe
But I don't have this directory.

I did some workaround and copied the Matlab.exe from
C:\Program Files\MATLAB\R2010b\bin\win64
to the directory Comsol is trying to use.

Now it works. But that's just some cheap workaround.
Thank you Kan for your advice. Unfortunately this doesn't work as I am using Matlab Win64. Comsol tries to execute Matlab Win32. And consequently Comsol is trying to open C:\Program Files\MATLAB\R2010b\bin\bin\win32\matlab.exe But I don't have this directory. I did some workaround and copied the Matlab.exe from C:\Program Files\MATLAB\R2010b\bin\win64 to the directory Comsol is trying to use. Now it works. But that's just some cheap workaround.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 08.05.2012, 06:21 GMT-4

Unfortunately this doesn't work as I am using Matlab Win64.
Now it works. But that's just some cheap workaround.

Looks like you didn't find comsolserver.ini located in C:\Program Files\COMSOL\COMSOL42a\bin\win64. Once you have found it, you can modify the path to Matlab as you wish. There are other .ini files in the same folder where you can correct the path to matlab. No need for a workaround like you did.

I'm using Windows 7 64 bit with Comsol 4.2a and Matlab R2011b 64 bit and this method works just fine. The last line of comsolserver.ini is:
-Dcs.mlroot=C:\Program Files\MATLAB\R2011b

you don't have to specify any further, just the general path to the MATLAB\R2011b folder will do it.

Good luck

[QUOTE] Unfortunately this doesn't work as I am using Matlab Win64. Now it works. But that's just some cheap workaround. [/QUOTE] Looks like you didn't find comsolserver.ini located in C:\Program Files\COMSOL\COMSOL42a\bin\win64. Once you have found it, you can modify the path to Matlab as you wish. There are other .ini files in the same folder where you can correct the path to matlab. No need for a workaround like you did. I'm using Windows 7 64 bit with Comsol 4.2a and Matlab R2011b 64 bit and this method works just fine. The last line of comsolserver.ini is: -Dcs.mlroot=C:\Program Files\MATLAB\R2011b you don't have to specify any further, just the general path to the MATLAB\R2011b folder will do it. Good luck

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 08.05.2012, 18:26 GMT-4
Agreed. I have the same environment (Win7 64bit + MATLAB R2011b 64bit). As long as the path in comsolserver.ini is correct, you will be fine Franz.

Note: You just need to specify the path of your R2010b folder, no need to go deeper than that.

-Dcs.mlroot=C:\Program Files\MATLAB\R2010b


This is all you need.
Agreed. I have the same environment (Win7 64bit + MATLAB R2011b 64bit). As long as the path in comsolserver.ini is correct, you will be fine Franz. Note: You just need to specify the path of your R2010b folder, no need to go deeper than that. [quote]-Dcs.mlroot=C:\Program Files\MATLAB\R2010b[/quote] This is all you need.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.