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.

Basic Comsol-Matlab Problem

Please login with a confirmed email address before reporting spam

Hi,

I am new to using comsol with matlab so i apologise if this is an obvious question.

As a first step I am simply trying to save a model as a .m file and then run it in matlab. When i try to do this is get the following error message in matlab:

Undefined variable "ModelUtil" or class
"ModelUtil.create".

Error in play1 (line 10)
model = ModelUtil.create('Model');

I am running comsol 4.2.0.228 on a mac, and matlab R2011b (7.13.0.564) both 64bit.

The model is an extremely simple one, just a 2D bimetallic cantilever with a fixed constraint at one end being subjected to a temperature.

Does anyone know what this error message means, and if its a common problem how i can fix it?

Are there any tutorials on using the Matlab LiveLink, comsol seem to provide them for most other modules but i couldn't see any?

Any help is much appreciated.

Joe

1 Reply Last Post 14 nov. 2011, 09:40 UTC−5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14 nov. 2011, 09:40 UTC−5
Could it be that you didn't start "COMSOL 4.2a with Matlab", but just Matlab alone? You didn't specify that in your post. Because if you just start Matlab, it doesn't import the Comsol libraries and you'd end up with an error message like you described because Matlab won't have a clue what "ModelUtil" is.

Like most modules, the Matlab Livelink ships with a "User's Guide" and an "Introduction to LiveLink for MATLAB". You'll find a simple tutorial in the latter document.
Could it be that you didn't start "COMSOL 4.2a with Matlab", but just Matlab alone? You didn't specify that in your post. Because if you just start Matlab, it doesn't import the Comsol libraries and you'd end up with an error message like you described because Matlab won't have a clue what "ModelUtil" is. Like most modules, the Matlab Livelink ships with a "User's Guide" and an "Introduction to LiveLink for MATLAB". You'll find a simple tutorial in the latter document.

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.