How do I read workspace variables?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I read workspace variables?

Suzuki
Is there a way to set workspace variables of MATLAB as boundary conditions?
Reply | Threaded
Open this post in threaded view
|

Re: How do I read workspace variables?

Precise Simulation
Administrator
Suzuki wrote
Is there a way to set workspace variables of MATLAB as boundary conditions?
Yes, but a workaroud. If the software encounters a coefficient or expression that is not defined, it will then try to find and evaluate a function with that name. An example for defining and using a custom function for an equation variable can be found in the link below, and it would work the same for a custom boundary coefficient:

https://www.featool.com/doc/physics.html#phys_coef_user

If you then want to use variables in the global Matlab workspace you can use expressions of the form:

    myvar = evalin('global', 'myvar');

to effectively fetch the variable 'myvar' from the global workspace to use in the function.