How can I retrieve a .mat file content (e.g. arrays or matrix)?
Show older comments
Hi, I have a mat file with 10 (columns) x 3 (rows) of data and I would like to retrieve these data to produce some readable output. For example, the first column of data is 1 0 0 and the output will be Yes.
May I know how can I perform the first step, which is how to get/read the data from the mat file? Thank you and your help is greatly appreciated.
Answers (1)
Azzi Abdelmalek
on 4 Nov 2012
In Matlab comman type
data=load('yourfilename')
What did you get?
11 Comments
Vivian
on 4 Nov 2012
Azzi Abdelmalek
on 4 Nov 2012
type data with all fieldnames
data.a12345.values
Vivian
on 4 Nov 2012
Vivian
on 4 Nov 2012
Azzi Abdelmalek
on 4 Nov 2012
y=data.a12345
Vivian
on 4 Nov 2012
Azzi Abdelmalek
on 4 Nov 2012
what is the size of y , type
size(y)
Vivian
on 4 Nov 2012
Azzi Abdelmalek
on 4 Nov 2012
how many rows and columns?
Azzi Abdelmalek
on 4 Nov 2012
Edited: Azzi Abdelmalek
on 4 Nov 2012
If
y=[1 1 0 1 1;0 0 1 0 1;0 0 0 1 1];
test=all(y(:,1)==[1;0;0]) % if test=1 means yes, 0 means no
Jan
on 4 Nov 2012
@Vivian: You are asking very basic questions. I strongly recommend to read the Getting Started chapters of the documentation, which would explain all fundamental Matlab commands. It is not possible to handle such a powerful tool as Matlab without reading the instructions.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!