How to create structure file?
6 ビュー (過去 30 日間)
古いコメントを表示
回答 (2 件)
Umakant
2015 年 3 月 27 日
The following code creates 1x20 structure, each with four fields:
mystruct(20).x =1
mystruct(20).y =2
mystruct(20). type=3
mystruct(30).cost=4;
0 件のコメント
Stephen23
2016 年 1 月 11 日
編集済み: Stephen23
2016 年 1 月 11 日
Read this and try some of its examples:
nums(1).f = 1;
nums(2).f = 2;
nums(3).f = 3;
allNums = [nums.f]
Note that you can create the complete non-scalar structure all at once using struct, which might be the easiest option for you:
S = struct('f',{1,2,3})
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!