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.

How can I import position-dependent variables into Comsol matlab code using livelink?

Please login with a confirmed email address before reporting spam

I am using Comsol with Matlab livelink. Please, find my attached Matlab code and mph file. Directly in Comsol matlab code, I computed phi0 which gives the initial values of variable phi on each of the nodes (line 134-156). I used the mesh discretization of 40 by 80 which gives a total nodes of 41*81. And the code runs completely.

Now, using the same discretization, I computed phi0 with another code (line 8-42), which I assigned to phi3 (line 46 and 47). I inputed phi3 as phi0 in Comsol (line 157). I have the coordinates of each nodes and their corresponding phi3. I used num2str in line 157 to assigned phi3 as phi0 which includes the x and y coordinates of each node and their corresponding phi0 (line 46) but the code gave error. I also used line 47 which contains only phi3, without x and y coordinates. But the code also gave error. It also gave error when I exported phi0 from Comsol and I tried to plug the exported phi0 back into Comsol. Error message: Error in multiphysics compilation. Syntax error in expression. Please, help me. How can I use calculated phi0 ( position-dependent variable) obtained from external source on each of the nodes of a Comsol model directly from the Matlab code generated from the model? I have the x and y coordinates of each of the nodes and the corresponding phi0.



0 Replies Last Post 17.01.2019, 16:02 GMT-5
COMSOL Moderator

Hello Samuel Ayinde

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.