Effacer les filtres
Effacer les filtres

Simulink - how to access time-series data loaded via a "From File" block?

29 vues (au cours des 30 derniers jours)
Kenny
Kenny le 12 Fév 2018
Commenté : Birdman le 12 Fév 2018
Hi all. I know that time-series data can be written to a .mat file via the "To File" block.
Now, if we use Simulink to load a particular .mat file that contains time-series data within it (eg. a structure), then what kind of simulink blocks can we use (as utilities) to access the embedded time-series data?
I know how to access the time-series (structure) data using Matlab command line, but also wondering what methods can be used with simulink itself?
Thanks for any help in advance!

Réponse acceptée

Birdman
Birdman le 12 Fév 2018
To solve this issue, you can use From Workspace block, which also allows you to use structure data in Simulink but you need to load your data from mat file to workspace before simulation. To do so, do as follows:
1- Go to File->Model Properties->Model Properties->Callbacks->PreLoadFcn and there, write the necessary code to load your data to workspace.
2- In Simulink, use From Workspace block and write the name of your data in the block to use it.
Hope this helps.
  2 commentaires
Kenny
Kenny le 12 Fév 2018
Modifié(e) : Kenny le 12 Fév 2018
Hi Birdman!!
Thanks very much for your time and help! I followed your advice and put code in the PreLoadFn area. But it appears that simulink ignored my code. So I put my code in the InitFcn* area instead, which worked (ie. simulink at least did something with the entered code).
Thanks again Birdman. Very much appreciated!
Birdman
Birdman le 12 Fév 2018
You are welcome :)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by