How to dynamically generate a variable name based on the instance of a masked subsystem within a library block in Simulink?
Show older comments
I tried to form a line model for my grid simulation and record some simulation results (current and power) at the same time. So this model is in my lib file. The easy way will be I take the recorded results into a bus output. And then when I initianize the instances in the simulink, I take a new bus element out node to save the results. But it will make the grid looks more caos because of so many nodes. I am thinking is it possible to
- Put a parameter in the mask for example "filename" and then let the "to workspace" block takes "filename" as the variable name
- Let model dynamically generate a variable name based on the instance in the simulink so it can filename1, filename2.. while I intiate the instances in the simulink.
The first method, I tried it, didn't work because the "to workspace" block takes "filename" not as a parameter but a constant string. So I want to know is it possible to realize what I want to do?
Accepted Answer
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!