Info
This question is closed. Reopen it to edit or answer.
Hi!I have been trying a lot and I could not get the solution.Could someone please help me?
1 view (last 30 days)
Show older comments
I have the outputs in work space which is an array I need to take simulink as input to the other block?Can anyone tell me the procedure how to do it?
0 Comments
Answers (2)
Walter Roberson
on 25 Jun 2018
You can use To Workspace, and From Workspace. However, the contents are not written to the workspace until the simulation is paused or stopped.
5 Comments
Walter Roberson
on 25 Jun 2018
You would need to put an extra 0 at the beginning of X1 in order to indicate time 0 . Then you would use a From Workspace block to import it as a signal that was a vector of length 501. You would configure the "Form output after final data value by" property as holding the last value. The result would be that at time 0, it would import the vector of length 501, and pass the entire vector around as a signal (all of it existing at the same time), and with the property of holding the last value turned on, the signal would continue to be that vector as long as your simulation ran.
You would take this approach if you wanted to create the item as a signal. There are cases where you would want to instead use the data as a property of a block.
If the intention is that the first time the value was read it was 0, the second time it was 0.1, the third time 0.2, and so on, then you might have forgotten that in Simulink all actions have to have a time associated with them. Simulink will solve forwards and backwards in time as needed to achieve the required precision. There is no "next value in the sequence" in Simulink. There might be a fixed time step and an intention that the values happen in consecutive time steps: if so then it is still a time that needs to be associated with the data.
Ankita Bansal
on 25 Jun 2018
Edited: Ankita Bansal
on 25 Jun 2018
Hi, let's say you want to add X1 to a sine wave in simulink. For this you have to give X1 as one input to the adder block which can be done by writing evalin('base','X1') in the "Data" parameter of "From Workspace" block.
2 Comments
Walter Roberson
on 25 Jun 2018
Or in this case you should be able to write just X1 in the Data parameter, which would allow it to search the hierarchy of data locations.
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!