Anyway to Pre-allocate Memory for Struct
2 ビュー (過去 30 日間)
古いコメントを表示
Is there anyway to pre-allocate memory for a struct?
I have a
1x2 struct with 2 fields.
>> s = struct('Name',0,'Name2',0)
But, it comes up as a 1x1 struct.
0 件のコメント
回答 (3 件)
Walter Roberson
2015 年 7 月 17 日
s = struct('Name',{0,0},'Name2',{0,0});
That is, use a cell array, one entry per struct member.
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!