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).
2 Answers
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

- 8,034
- 36
- 110
- 176
-
Thanks for answers. And do you know how to write in .m file instead of simulink? – Mr Min Nov 30 '11 at 21:38
-
You can access the value in the vector form using `simout.signals.value` Is that what you are looking for ? – Kiran Dec 01 '11 at 09:42
-
I don`t understand.Problem like this, I have data to input.But how to put from workspace.My data was <1000,1>.How to put these data instead of integrator,Constant,etc.Thanks for helping. – Mr Min Dec 05 '11 at 15:55
You can use simulink block "From Workspace". Search in the simulink library if required.
Your data from the workspace must have at least 2 columns, i.e. 1. Time stamp 2. Signal Both column vectors must have with the same dimension if not error message will pop out.
For example in the workspace
A<5x2 doubles>
A = [ 14.3 0.5 ;14.2 0.48; 14.1 0.44; 14.1 0.5; 14.6 0.6];
Then, in Simulink , using the From Workspace, insert [A] in the Data field as shown in the examples. See http://www.mathworks.com/help/simulink/slref/fromworkspace.html
Finally Run your simulink model ! Have Fun
¬atck

- 33
- 1
- 6