Cannot load a Mat file into Simulink

6 次查看(过去 30 天)
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 :)

采纳的回答

Fangjun Jiang
Fangjun Jiang 2023-10-27
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 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by