Cannot load a Mat file into Simulink
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nils
am 27 Okt. 2023
Beantwortet: Fangjun Jiang
am 27 Okt. 2023
Hello all,
I want to load a Matlab file into the Simulink environment. I am sampling with 187500 Hz an 8-bit signal, and I would like to import that sample into Simulink.
The length of my signal is 4096 points.
I tried several things to load the data into Simulink with the form file:
Directly: So I imported a 1x4096 double array and changed the sample time to my frequency. Didn't show any signal in the scope. I tried to transpose my data, so I got a 4096x1 double array. Still, it didn't work.
With a 2D file, I tried to create a 2D array, so a 4096x2 with one column for the time and one for the data still didn't work. I tried to transpose it again, but it still didn't work.
With Timetable: I tried to pack the data into a timetable with the array2timetable function, but Simulink wasn't able to load the file at all.
I'm probably doing something fundamentally wrong.
I will attach my signal, my signal with a time column, and the Simulink file to load and display my signal.
I saved the Matlab file with the following command:
save SampleData2DTable.mat signal -v7.3;
Thanks for your help :)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1522806/image.png)
0 Kommentare
Akzeptierte Antwort
Fangjun Jiang
am 27 Okt. 2023
Most likely due to incorrect data format. Look at this page under "Load Array Data" section.
To load array data, first Row needs to be the time vector, if using "From File" block,
while first Column needs to be the time vector, if using "From Workspace" block.
Why, Mathworkers?
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sources finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!