Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Export Simulink Data to Excel

1,497 views
Skip to first unread message

raj

unread,
May 26, 2011, 1:48:05 PM5/26/11
to
Hi All,

I have a simulink model. I would like to import all the inputs, outputs, locals and all other parameters to an Excel sheet.

can someone please help me how to do this?

Regards,
R.S.

Phil Goddard

unread,
May 28, 2011, 1:42:02 AM5/28/11
to
Use xlsread to import the data into MATLAB, then use any of the standard Simulink way (i.e. From Workspace, Inports, etc) to get the data from MATLAB into Simulink.

Then reverse the process an use xlswrite to put results back into Excel.

Phil.

raj

unread,
May 30, 2011, 7:40:19 AM5/30/11
to
Thanks Phil for your response. I know the xlsread/write function, but first I need all the simulink inputs, outputs, locals and all other parameters to be stored in a variable/structure from where i can import them into excel. So how to get all these simulink data?

Regards
Rajesh

"Phil Goddard" <philN...@modeling-simulation-visualization.com> wrote in message <irq1va$ocj$1...@newscl01ah.mathworks.com>...

Phil Goddard

unread,
May 30, 2011, 10:53:04 PM5/30/11
to
Half of your question is being asked back-to-front.

All things that are required by your model, e.g. parameters and input data, should be defined in MATLAB first and the model, on initialization, should get that info from MATLAB.

e.g. if the amplitude of a sine wave needs to be 4 (for instance) you should define a MATLAB variable, say sineAmp, as simeAmp=4, then in the appropriate Simulink parameter dialog you should type sineAmp (not hard code the number 4).

But if for some reason you really decide that you need to get the value of a parameter from the model then you would use the get_param function, see
>> doc get_param

The are multiple different ways to push data generated by your model into MATLAB: though an Outport block; through a Scope block; using a To Workspace block, just to name three ways.

Then it's just a matter of creating an appropriate cell array to use with xlswrite.

Phil.

Phil Goddard

unread,
Jun 1, 2011, 9:43:04 AM6/1/11
to
Also, be aware that since R2010a (I think) you can execute
>> allVars = Simulink.findVars(modelName)

to get a list of all variables that a model uses.

Phil.

0 new messages