Import data in Simulink

2 views (last 30 days)
Mitch Martelli
Mitch Martelli on 1 Jun 2012
Hi
I would like to import in Simulink about 30 variables (with constant value) declared in .m file and the use these in one Embedded MATLAB Function with their own name.
I try to import the .m file with the library block 'From File' but doesn't works.
I try to import a structure with the library block 'From Workspace' but doesn't works.
I would not to use 30 single block From Workspace and then pass 30 parameter to Embedded MATLAB Function.
I would not to create one array filled with the 30 data and then modify the code inside the function.
There is some other smart way to do this?
Thanks in advance
Mitch

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 5 Jun 2012
Sorry, your question is not very clear to me. Could you explain why the 'From File' and 'From Workspace' blocks didn't work - if there was an error, please specify the error message.
Have you tried using Constant blocks since it appears your variables have constant values?
It's also not clear if these variables acts as inputs to the Embedded MATLAB Fcn blocks, or if they just need to be parameters. If they are parameters, you don't need to import them as signals into your models, just create parameter data on the Embedded MATLAB Function block with the same names as the workspace variables. Simulink will resolve the variables automatically in the workspace.

More Answers (0)

Categories

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!