How do I preallocate a struct array from the importdata function (In a loop)

2 ビュー (過去 30 日間)
Alex
Alex 2012 年 8 月 31 日
Hi, I would like to preallocate my data space that comes from the importdata command, but I am having trouble because it is just a little too complicated for me. After I run the importdata in the loop I end up with:
x =
1x10 struct array with fields: data textdata
x.data is a 21x1248 double array
x.textdata is a 4x22 cell array
This comes from something similar to:
for fnum=1:10
fname=sprintf('file%02d.csv', fnum);
x(fnum)=importdata(fname, ',', 4);
end
what is the command I should run to preallocate this structure array?
Thanks!

回答 (1 件)

Albert Yam
Albert Yam 2012 年 8 月 31 日

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by