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.

Update solution in LiveLink for MATLAB

Björn Zaar Fusion plasma physics

Please login with a confirmed email address before reporting spam

Hi!

I'm currently developing a model using LiveLink for MATLAB, but I've run into some trouble. After I have solved my model, I need to extract the solution (the electric field) to compute the absorption in MATLAB. I then save the absorption to a txt file and import it back into COMSOL. All this works nice and and well, but when I then want to make a variable of this absorption, I need to update the solution. Is there a way to do so easily with LiveLink? I have looked in the User's guide, but I haven't found anything about this. Any ideas?

Best, Björn


2 Replies Last Post 16 juil. 2020, 05:20 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 7 juil. 2020, 13:51 UTC−4

Hi Bjorn,

It seems like not all commands are described in the documentation. However, one method I found to determine the Matlab commands I need is to first configure the Comsol GUI for a simple case, then save the Comsol file as a Matlab file. You can then see all the necessary commands that Matlab uses to configure Comsol.

In your case, to update sol1, you would need to do: model.sol('sol1').updateSolution;

Cheers,

Alex

Hi Bjorn, It seems like not all commands are described in the documentation. However, one method I found to determine the Matlab commands I need is to first configure the Comsol GUI for a simple case, then save the Comsol file as a Matlab file. You can then see all the necessary commands that Matlab uses to configure Comsol. In your case, to update sol1, you would need to do: `model.sol('sol1').updateSolution;` Cheers, Alex

Björn Zaar Fusion plasma physics

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 16 juil. 2020, 05:20 UTC−4

Hi Alex,

Thanks for your advice, it worked perfectly!

Best, Björn

Hi Alex, Thanks for your advice, it worked perfectly! Best, Björn

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.