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.

Evaluate Matlab-Function in Model-Parameter: example in LiveLink documentation seems not to work

Please login with a confirmed email address before reporting spam

Hi,
i'm trying to to run the following example (page 33, LiveLink for Matlab User Guide):

import com.comsol.model.*;
import com.comsol.model.util.*;
model = ModelUtil.create('Model');

model.func.create('extm1', 'MATLAB');
model.func('extm1').setIndex('funcs', 'my_fun', 0, 0);
model.func('extm1').setIndex('funcs', 'x, y', 0, 1);
model.param.set('E0', 'my_fun(x,y)');

This should get me the return value of the evaluated Matlab function stored in parameter E0.
But with
model.param.get('E0')
the system just returns
ans = my_fun(x,y)
instead of the parameter value. Any ideas what i've done wrong?

0 Replies Last Post Aug 17, 2011, 8:36 a.m. EDT
COMSOL Moderator

Hello Chris Shor

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.