Save Signals in Simulink
16 次查看(过去 30 天)
显示 更早的评论
Hello,
Is it possible to store signal's in a simulink block? I work with CANoe and Simulink. The CANoe Singal Input Block send constantly with a Sample Rate from 100 Hz particular Signals (acceleration of a car). I want to store this Signals in a Block to calculate for example the minimum value over the whole data's.
I hope you understand my question.
Greetings from Germany
0 个评论
回答(3 个)
Munish Raj
2019-3-18
Hello Zaucher
To save information in simulink, you could write the information to a mat file.
The 'To File' block in simulink can be used for this.
To process the data after the the simulation is complete you could use the StopFcn callback.
All the lines of code in the StopFcn callback will be executed after the model is done executing. This would be an optimal time to perform functions on the entire saved data.
Alternatively , if you want to load from mat file, you could use the 'From file' block,
Thank you
Munish Raj
0 个评论
Zaucher
2019-3-20
1 个评论
Munish Raj
2019-3-20
Hello
In the begenning of the StopFcn callback ,you could use
load('name_of_file.mat')
This will load the variables in the .mat file into the workspace.
The name_of_file will be found in the ToFile block(double click the block to find the name of the file).
Now, you have access to the hunter_acceleration variable, which is also present in the MATLAB workspace.(MATLAB and simulink uses the same workspace).
In the StopFcn Callback, you can use the seperate .m file the same way you would use it from the MATLAB command line.
Any line of code can be written in the StopFcn Callback(or any callback).
I hope this solves your doubt
Thank you
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!