Problems with running COMSOL with MATLAB

  • Context: MATLAB 
  • Thread starter Thread starter twlewisut
  • Start date Start date
  • Tags Tags
    Comsol Matlab Running
Click For Summary
SUMMARY

The discussion addresses issues encountered when running COMSOL with MATLAB R2007b. Users reported that after selecting the "MATLAB interface" during installation, they could not find the "COMSOL with MATLAB" folder or access the 'comsol' function in MATLAB. The primary solution involves setting the Windows environment variable MATLAB_RESERVE_LO to 0 to resolve memory allocation issues introduced in MATLAB 2007b. A secondary solution includes editing the java.opts and comsol.opts files to prevent automatic overwriting of settings.

PREREQUISITES
  • Familiarity with COMSOL Multiphysics installation procedures
  • Basic understanding of MATLAB R2007b environment variables
  • Knowledge of file editing in Windows operating systems
  • Experience with troubleshooting software integration issues
NEXT STEPS
  • Research how to set environment variables in Windows for MATLAB
  • Learn about memory allocation strategies in MATLAB versions
  • Explore COMSOL Multiphysics documentation for MATLAB integration
  • Investigate common troubleshooting techniques for COMSOL and MATLAB compatibility
USEFUL FOR

This discussion is beneficial for users of COMSOL Multiphysics and MATLAB, particularly those integrating the two applications, as well as technical support personnel and software developers troubleshooting compatibility issues.

twlewisut
Messages
1
Reaction score
0
Hello.

I recently obtained a trial version of COMSOL, and was trying to run COMSOL with MATLAB. During the installation process, I clicked option "MATLAB interface" under the "Features" tab. After installing COMSOL, I could not locate the "COMSOL with MATLAB" folder in my Programs menu. Also, I tried typing in "comsol" into the command window in MATLAB, but it said that it didn't recognize the function 'comsol.' The MATLAB that we have is MATLAB R2007b. Is this an acceptable version of MATLAB. If so, do you know what I could be doing wrong? I appreciate any help you may be able to give.

Thanks in advance!
 
Physics news on Phys.org
During installation there is a check box that you must click to include the MATLAB and comsol interface. you may need to reinstall the program. If you have MATLAB 2007b you also may have additional trouble after installing the interface. follow these instructions.

Problem Description
When I start COMSOL with MATLAB 2007b, neither MATLAB nor the COMSOL Multiphysics user interface appear.
Solution
This problem has been reported by some users of COMSOL with MATLAB 2007b on Windows. MATLAB 2007a and earlier versions are not affected by this problem.
The problem seems to be related to a new memory allocation strategy introduced in MATLAB 2007b, and the solution is to tell MATLAB to use the old strategy instead by setting the Windows environment variable MATLAB_RESERVE_LO to 0.
Primary solution
To fix the problem, The MathWorks recommends to set this environment variable as follows:
1. In Windows, click Start > Control Panel > System > Advanced > Environment Variables.
2. Click the New button in the System variables frame.
3. Enter MATLAB_RESERVE_LO in the Variable name field and 0 in the Variable value field.
4. Click OK and close the dialog boxes.
Secondary solution
In some rare occasions, the primary solution might not help. Then try the following:
1. Try to start COMSOL with MATLAB once. It will fail but a file java.opts will be written to the COMSOL 3.4 installation directory.
2. Open the java.opts file, remove the line -Xmx256m and save the file.
3. Open the file comsol.opts in the bin directory under your COMSOL installation and change the line

JAVAOPTS=on

to

JAVAOPTS=off

This will ensure that a new java.opts file is not written automatically every time you start COMSOL with MATLAB and your manually edited comsol.opts will always be used.
4. When you use "Connect to MATLAB" from the File menu in COMSOL Multiphysics it will look for a java.opts file in your home directory. This means that you should copy the edited java.opts file to the home directory as well. This will be something like

C:\Documents and Settings\
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
13K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
23K
  • · Replies 2 ·
Replies
2
Views
6K