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 to retrieve a variable from MATLAB and use in COMSOL

Please login with a confirmed email address before reporting spam

Hi all.
I am using MATLAB in my COMSOL model. After defining all the input variables in the .m file and saving it in the same directory with the .mph file, the simulation shows no error but i don't know how i can access and use the output variable from the .m file?
e.g. function[Ax]=permtty(tx, kx, lam0) .....how can i retrieve and use "Ax" in the COMSOL model?

Hope anyone can help.

1 Reply Last Post May 16, 2017, 6:17 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago May 16, 2017, 6:17 a.m. EDT
Updated: 7 years ago May 16, 2017, 8:20 a.m. EDT
Hi

Is the function permtty something you wish to evaluate while solving?

Then look in the manual "Introduction to LiveLink for Matlab" in this chapter "Using External MATLAB® Functions" for a way to call the function from COMSOL Multiphysics.



Hi all.
I am using MATLAB in my COMSOL model. After defining all the input variables in the .m file and saving it in the same directory with the .mph file, the simulation shows no error but i don't know how i can access and use the output variable from the .m file?
e.g. function[Ax]=permtty(tx, kx, lam0) .....how can i retrieve and use "Ax" in the COMSOL model?

Hope anyone can help.





--
Lars Gregersen
Comsol Denmark
Hi Is the function permtty something you wish to evaluate while solving? Then look in the manual "Introduction to LiveLink for Matlab" in this chapter "Using External MATLAB® Functions" for a way to call the function from COMSOL Multiphysics. [QUOTE] Hi all. I am using MATLAB in my COMSOL model. After defining all the input variables in the .m file and saving it in the same directory with the .mph file, the simulation shows no error but i don't know how i can access and use the output variable from the .m file? e.g. function[Ax]=permtty(tx, kx, lam0) .....how can i retrieve and use "Ax" in the COMSOL model? Hope anyone can help. [/QUOTE] -- Lars Gregersen Comsol Denmark

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.