please help me I want to import data to wok space and export data from work space during simulation in the same model ?

In my model I want to collect A set of numbers (which is variable by changing the switch ) I want to equal the output of summation to variable (N) where I want this variable in another block like gain the problem in work space is save date after simulation end I want to read N during simulation (where N is variable) The figure of model is attached below How can I do it??

Antworten (1)

5 Kommentare

Thanks for response but I want the output of sum equal parameter N where I used it in another block (like input parameter N in wind turbine block) where N refer to number of wind turbines i used I can not do it by goto how can I do it???
my model is like this I want the output of sum equal parameter N where I used it in another block (like input parameter N in wind turbine block or gain block) where N refer to number of wind turbines I used it say if N=3 I want to use it in wind turbine (3*850KW) if N is change by change the switching (say N=4) so number of wind turbines I use is (4*850KW) and so on I want to export and import simulink data? when I use to workspace the data is save at end of simulation(N is change to 4 but not change in wind turbine block or in block gain)
If you can write your conditions for N as MATLAB code, then you can guarantee it runs first by putting it in the model initialization.
I am grateful to you But you still not understand me N is a variable number (may be change from 0 to inf(i.e 8 or 10 or 0)) I can not define it (during simulation N is changing but not change in block(gain or wind turbine)) I used to workspace but I can only get data after stopping the simulation, but what I want is getting data during runtime and send these data to another program (or any block in the same model ) so that the program can get the correct data it needs???? How can I do it?????? How can I import and export data in the same model during simulation??? I appreciate your respone
Simulink is not intended to be used that way, which is why I am proposing solutions slightly different than what you are asking.
The proper solution is to make modifications to your blocks such that "N" is a signal and not a parameter.
To learn why, and potential "hacks" (with their own drawbacks) such as using set_param(), see this article.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Modeling finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

MAB
am 2 Feb. 2015

Kommentiert:

am 5 Feb. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by