How to use workspace variables in simulink's matlab function?
Show older comments
I have a structure in workspace and intend to use its variables several times in simulink function. Creating a constant block with the "par" (name of my structure in workspace) and then passing it as an input in the function block is giving me errors.
2 Comments
Raj
on 13 May 2019
Without any data, it is difficult to guess how exactly you are trying to pass the data, how you are trying to use the data in your function block and why you are getting an error. If possible share your workspace data mat file and model.
Smit Saparia
on 13 May 2019
Answers (1)
Sulaymon Eshkabilov
on 13 May 2019
0 votes
Hi,
Here is a quick and easy solution. A small trick to make MATLAB Fcn block of Simulink to accept the data from the structure type of variable value (s) from the MATLAB workspace.
Good luck.
2 Comments
Smit Saparia
on 14 May 2019
Sulaymon Eshkabilov
on 14 May 2019
Hi,
Use the right mouse button option - and click - Save link as ... that downloads the file (SIM_main.slx) into your computer.
Good luck.
Categories
Find more on Sources 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!