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

1 view (last 30 days)
Baris Can
Baris Can on 30 Nov 2012
Commented: satish kumar on 11 Aug 2020
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

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 30 Nov 2012
Edited: Azzi Abdelmalek on 30 Nov 2012
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 Comment
satish kumar
satish kumar on 11 Aug 2020
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.

Sign in to comment.


Baris Can
Baris Can on 30 Nov 2012
Edited: Baris Can on 30 Nov 2012
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.

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!