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 30 nov. 2020, 09:41 UTC−5

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 30 nov. 2020, 09:29 UTC−5

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 30 nov. 2020, 09:41 UTC−5

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.