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 2017年5月16日 GMT-4 06:17
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2017年5月16日 GMT-4 06:17
Updated: 8 years ago 2017年5月16日 GMT-4 08:20
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.