How to keep adding rows in a structure inside a for loop
42 ビュー (過去 30 日間)
古いコメントを表示
The screenshot below is what I want to accomplish. I have a for loop that, for each organ name, calculates the coverage, maxdose, and meandose. I would like to create an empty structure, then inside the for loop, for each iteration, store the corresponding information in a row, and then adds on to it for the next iteration. How would I do this?
psuedo code:
create a struct called PatientInfo with fieldnames: 'name', 'coverage', 'maxdose', and 'meandose'
for i = 1:4
calculates the corresponding coverage, maxdose & meandose;
writes these values to a row
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169381/image.png)
0 件のコメント
回答 (2 件)
Walter Roberson
2018 年 1 月 24 日
編集済み: Walter Roberson
2018 年 1 月 24 日
PatientInfo = struct('name', {'BodyAuto', 'BrainStem', 'SpinalCord', 'Parotid_R'}, 'coverage', [], 'maxdose', [], 'meandose', []);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!