Info

此问题已关闭。 请重新打开它进行编辑或回答。

Hi!I have been trying a lot and I could not get the solution.Could someone please help me?

1 次查看(过去 30 天)
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?

回答(2 个)

Walter Roberson
Walter Roberson 2018-6-25
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 个评论
Walter Roberson
Walter Roberson 2018-6-25
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
Ankita Bansal 2018-6-25
编辑:Ankita Bansal 2018-6-25
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.

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by