Save Signals in Simulink
18 ビュー (過去 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!