0
votes

I have a problem when I try to import data to "from Workspace" block in Simulink.

I have data from the .m file, I want to write this data to "from Workspace." The system shows an error is "undefined variable." Someone have any idea for my problem.

Thank you!

1
The error message is pretty clear. The variable you are specifying to be read from the Workspace doesn't exist. You need to define it before running the model. Open the block and click on the Help button to see how to use the block.Phil Goddard
Thank for help. I already run it on the command windows. So now I want to run on the script file, but it doesn't define data a workspace.BÙI CÔNG LÝ
In your question, show a minimal example of what you have tried that works and what doesn't. Include the exact error message.Phil Goddard

1 Answers

0
votes

The "from Workspace" block allows to import values from already stored variables, not from any script. If you have your data in any script, you can run it and make sure the desired variables are in the workspace.

Also, the Simulink block asks for a specific data structure as follows:

Simulink Capture

If you're having troubles with this structure, you can do it in the other sense, use the block "to Workspace" and see the structure of the returned variables.

Command Window and Workspace Capture