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.

Setting the unit of the parameter in Matlab LiveLink Comsol 5.4

Please login with a confirmed email address before reporting spam

Hello,

I need to define the unit in Matlab. Therefore, I used the command obtained from LiveLink User's Manual 5.4 at page 150: something.set(property, [num2str(<value>)'[unit]'])

I applied to my code as:

x1=0.1;
model.set('a', [num2str(x1)'[mm]'])
(I wanted to assign 'a' value as 0.1[mm] )

But, I had an error: Unbalanced or unexpected parenthesis or bracket. When I add a comma after the value paranthesis, again the same error occurs.

Can you please help me abaout this issue? Thank you, Mervenaz


2 Replies Last Post Nov 30, 2020, 9:41 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Nov 30, 2020, 9:29 a.m. EST

Hi, Mervenaz. You need to add a space between num2str(x1) and '[unit] '. Just like this: for parameter, model.param.set('t0',[num2str(t1) '[s]']), or for boundary condition, dl.feature('pr1').set('p0', [num2str(pinj) '[MPa]']).

All the best,

Songcai

Hi, Mervenaz. You need to add a space between num2str(x1) and '[unit] '. Just like this: for parameter, model.param.set('t0',[num2str(t1) '[s]']), or for boundary condition, dl.feature('pr1').set('p0', [num2str(pinj) '[MPa]']). All the best, Songcai

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Nov 30, 2020, 9:41 a.m. EST

Hi Songcai, It worked. Thank you so much !! Best, Mervenaz

Hi Songcai, It worked. Thank you so much !! Best, Mervenaz

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.