how to read data from a .mat file

2.693 views (last 30 days)
Naema
Naema on 1 Apr 2015
Commented: Naema on 1 Apr 2015
Hi: I have a .mat file named Ey1a which I need to use it in my code as one of the inputs. The file contains complex data (real and imaginary).I read the file like this:
dlmread Ey1a.mat
but I had this error:
Mismatch between file and format string.
Trouble reading number from file (row 1, field 1) ==> MATLA
Error in ==> fiber_commentedoriginal at 38 dlmread Ey1a.mat;
also, I need to use the conjugate of Ey1a in my code, so how to do this as I can not load the Ey1a.mat file itself

Accepted Answer

per isakson
per isakson on 1 Apr 2015
Try
S = load('Ey1a.mat');
and see help for load
  22 Comments
Naema
Naema on 1 Apr 2015
Stephen: Yes, it works now. Before I multiply Z and S . I had to access both of them and then multiply them together.

Sign in to comment.

More Answers (4)

James Tursa
James Tursa on 1 Apr 2015
Edited: James Tursa on 1 Apr 2015
Use the load function to read .mat files. E.g.,
load Ey1a.mat
  4 Comments
LUI PAUL
LUI PAUL on 1 Apr 2015
Edited: LUI PAUL on 1 Apr 2015
load('Eyla.mat');
Eyla=conj(Eyla);

Sign in to comment.


Vinod Sudheesh
Vinod Sudheesh on 1 Apr 2015
You could use the "load" command to read data stored in a MAT file.
>> load Ey1a.mat
The "dlmread" function is used for reading ASCII delimited file.

LUI PAUL
LUI PAUL on 1 Apr 2015
for other directory.....
load('D:\data_file\Eyla.mat')
for current directory load('Eyla.mat');
or follow the figure....

LUI PAUL
LUI PAUL on 1 Apr 2015
to get conjugate
load('Eyla.mat');
Eyla=conj(Eyla);

Categories

Find more on Variables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by