Saving mat file with many signals from Simulink

I have a Simulink model that calculates many time series (position, velocity, power, etc) in different blocks. I would like to create a single mat file containing all of these signals, either from within Simulink or from the Matlab script that I will be using to execute the simulation with the sim commmand. What is the best way to do this?

 채택된 답변

TAB
TAB 2012년 2월 18일

1 개 추천

Save your variables from simulink to workspace using ToWorkspace block. Assign specific name to each variable.
And in your Matlab script save these variable to mat file once the simulation is over.
OR
alternatively you can use the variables save command in simulation stop callback fucntion (StopFcn) of your model as
save('MyFile.mat','position','velocity','power');
so variables will be saved automaticaly when simulation is comleted.

추가 답변 (1개)

sagar zankar
sagar zankar 2018년 3월 27일

1 개 추천

Connect all the signals to a MUX and connect the MUX to ToFile Block, you will get all the signals in a single mat file!

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

K E
2012년 2월 17일

답변:

2018년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by