'load' command - loading and using data from a .MAT file

Hi there I would like to load data from a .mat file but retain it's structure. It is a 17x17x17 matrix and at the moment I am simply using the following
load current1.mat
MAT = current1
But there seems to be a problem and I am told there is no such thing as current1 where am I going wrong. Also I need to be careful because some of the commands for loading and using data turn it into a 1x1 array??
I'm quite confused :(

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
編集済み: Azzi Abdelmalek 2013 年 8 月 7 日

0 投票

x=load('current1.mat');
MAT=x.current1
If you want to know the variables names in your file
whos('-file','current1.mat')

5 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
[Brian commented]
Unfortunately I get the following error message when typing in your code;
Reference to non-existent field 'current1'.
Error in fftndim9part11partfromauthor (line 5) MAT = x.current1;
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
check the variables name
whos('-file','current1.mat')
What did you get?
Bran
Bran 2013 年 8 月 7 日
I got the following:
Name Size Bytes Class Attributes
current 17x17x17 78608 double complex
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
That means, your variable name is current (not current1). Type
x=load('current1.mat');
MAT=x.current
Bran
Bran 2013 年 8 月 7 日
Thank you! It works fine now! :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by