Save Signals in Simulink
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (3)
Munish Raj
am 18 Mär. 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 Kommentare
Zaucher
am 20 Mär. 2019
1 Kommentar
Munish Raj
am 20 Mär. 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
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!