Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problems with running COMSOL with MATLAB

  1. May 22, 2009 #1

    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!
  2. jcsd
  3. Jun 8, 2009 #2
    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.
    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




    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\
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook