Initializing a char structure for a loop
5 ビュー (過去 30 日間)
古いコメントを表示
I am building up a char structure of file paths and names in a large for loop in the form
list=[]
for i =1:n
stuff
file = something
list=char(list,file)
end
My problem is that the first row of list is empty doing it like this. Is there a way to initialize a char array without creating an empty row? I can remove it afterwards but that seems messy.
And in case there is a generally better method of compiling file paths, I'm working within a pipeline that requires me to construct this.
Thanks
0 件のコメント
採用された回答
Walter Roberson
2015 年 5 月 8 日
list = cell(n, 1);
for i = 1 : n
stuff
list{i} = file;
end
list = char(list);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!