Input data to Simulink from workspace

Mr Min picture Mr Min · Nov 30, 2011 · Viewed 42.6k times · Source

Hello anyone does know? I have data(myData) from matlab workspace. And in matlab simulink I have to do control system with regulator.First how to put data(myData) to simulink model input,and I want to show in graph two value(myData and regulator).

Answer

Kiran picture Kiran · Nov 30, 2011

You can use the From Workspace block to read the data( lets say simin ) from the worspace.

The variable simin should a structure with following fields:

  • signals :

    • values : A column vector representing data.

    • Description : A string describing the data (can be empty)

  • time : The time stamp, Its a column vector, with dimension same as that of the signals field ( can be empty as well)

That's for importing data into Simulink. For exporting the data, you can use the To Workspace block in the Simulink library.

Notice, that the output will also be a structure unless, you specify in the properties of the To Workspace to be an array.

You can refer to the documentation here

Thanks