Why can't i use "from file" block in simulink

1 次查看(过去 30 天)
i have a .mat file that i want to use in simulink using "from file" block
you can look it up from this link https://www.dropbox.com/s/lhyrsan02wz3cl4/force.mat
i put a "from file" and "scope" blocks into simulink and then connect them with each other.
i configured sample time in from file block as 1 that is equal to same sample time in .mat file and used fixed step ode3 solver with auto fixed-step size.
when i run, matlab gives no error, but i see this http://s7.postimage.org/y8ue6cmwr/matlab.png when i open scope

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2012-11-30
编辑:Azzi Abdelmalek 2012-11-30
The problem is how you saved your data. Example
t=0:0.1:10; % vector time
y=sin(t) % t and y are line vectors
ty=[t;y] % ty should be a matrix with 2 rows
save filename ty
Now you can use your file in your simulink model. I think that you saved ty with two columns instead of 2 rows,
  1 个评论
satish kumar
satish kumar 2020-8-11
Hello, i tried to load the data: t=[45, 67,8.9,6.7,5.5,3.2,5.6,7.9] into simulink using " from file " block in simulink. t is saved as .mat file. t is generated from matlab code. I am facing problem in loading all the points in simulink. the first data point in t, i.e. t(1)=45 is not loaded in simulink. others have been successfully loaded. Please help how to load data in array form like this without missing first point. kindly help.

请先登录,再进行评论。


Baris Can
Baris Can 2012-11-30
编辑:Baris Can 2012-11-30
i solved the problem, i realized that i was trying to use only one column instead of two columns, i misread that number of rows as a time-serie column that i already wrote, also the block that i need to use wasn't from file, it was from workspace block.
thanks for answers.

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by