Complex matlab script migration into simulink
6 views (last 30 days)
Show older comments
I'm currently working with a rather length Matlab script, and am trying to move it onto simulink to adopt a more 'drag n drop' logic flow, as in Simulink we are able to use both custom function blocks as well as default lib blocks. After trying to move this script to Simulink I realized that I have been running into a lot of code generation incompatibility errors, I'd like to ask whether I can "pull" a plot from the base Matlab workspace into Simulink when I run a Simulink function?
Say that I click on a specific block on Simulink that triggers a script in the base workspace to run, and then the results and plots from the base workspace script are "sent" to Simulink.
Is this achievable?
Thanks!
4 Comments
Paul
on 31 Jul 2024
As for what type of block, I am referring to a custom MATLAB function block within simulink, one where you can script your own functions inside.
correct, by clicking on a block I meant double clicking on it to run the scripts inside.
The Matlab Function in Simulink is intended for running Matlab code when as part of a Simulink simulation. Double clicking on that block in the diagram is typically meant to open the editor to edit its code, add parameters, etc. Double clicking on that block is not typically meant to run its code (though it may be possible to do so with some effort depending on the actual behavior that's desired). Perhaps I still don't understand what you're trying to accomplish, but at this point I'm not even sure that Simulink, which is intended for forward-time simulation, is the right tool to use.
Answers (0)
See Also
Categories
Find more on Simulink Coder 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!