Save Signals in Simulink
14 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Munish Raj
on 18 Mar 2019
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 Comments
Zaucher
on 20 Mar 2019
1 Comment
Munish Raj
on 20 Mar 2019
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
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!