Loading a sequence of files into Matlab - can't define 'cell'

1 回表示 (過去 30 日間)
Mau Dudas
Mau Dudas 2019 年 11 月 26 日
コメント済み: Mau Dudas 2019 年 11 月 26 日
I would like to load 200 data which is stored in 1x1 structures with three fields. Load command is pretty useless at this point so I tried this.
files= dir('data*')
numfiles=size(files)
mydata = cell(1,numfiles)
for k = 1:numfiles
mydata{k}= importdata(files(k).name)
What value does 'cell' stand for?
I can apply the rest to my dataset I just can't seem to load it properly.

回答 (1 件)

Image Analyst
Image Analyst 2019 年 11 月 26 日
cell() doesn't stand for any value. It instantiates (pre-allocates) a cell array of empty contents - one empty cell for each of the files you found. I think if you read the FAQ you'll have a better idea of how cells work. ?
importdata() can bring in who-knows-what, so that's why we need a cell since each cell can contain something completely different, unlike other arrays. If each dataset is the same size, shape, and class, then you might use a double array to hold everything instead of a cell array.
  1 件のコメント
Mau Dudas
Mau Dudas 2019 年 11 月 26 日
So is it basically a new variable i get to define and store the data that I import in?

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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by