Loading a mat file in Simulink for signal reproduction

1 view (last 30 days)
I need to input in my mdl file data with prerecorded signals [2xm] where first line is the time and each of the other lines are the different variables. The data can vary from file to file (values/s, time length, total number of values) and can be rather big (several Mb). I need to be able to change the instant of the played scenario (like at a given moment to chose to continue from the moment T or to restart (T=0). That is why I used a Look up Table Dynamic where I can change the time (x entry) and according to it, the moment of the played scenario.
As constants cannot be of variable size [2xm] and because of some larger files, I thought of using a buffer constant of a fixed [2xM] that can be changed every M steps to the next M values of the mat file. The changing procedure is done by a Matlab Function, but this Mfcn needs the data from the mat file. If the input for the Mfcn is a constant this means I can load the file only once at the beginning of the simulation (initfunction callback of the mdl file). This also makes redundant the use of the buffer. I am searching for a variable size data input for this Mfcn that will run after each M values were outputted.
Ruled out solutions: From workspace or From file (inter/extrapolated values according to current simulation time)
Do you have any idea how to do this properly (without a lot of memory usage as the mdl is used in real time simulation)?

Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!