フィルターのクリア

Saving a Loop Answer as Matrix

1 回表示 (過去 30 日間)
Nihar Jariwala
Nihar Jariwala 2021 年 3 月 24 日
回答済み: David Hill 2021 年 3 月 24 日
Hi Everyone,
I have my code running in a for loop, for 8 files. The answers received from these files are like:
ans = (1,2,3,4,5,..........) %This is from file 1
ans = (1,2,3,4,9,83,37,.........) %This is from file 2.
Similarly I have answers from all the 8 files.
My question is how can I save all the answers in Individual arrays?
Regards,
Nihar.

回答 (1 件)

David Hill
David Hill 2021 年 3 月 24 日
Save in a matrix would be better as long as the sizes are the same (pad with nan or 0 if not the same size). Much easier to index into a single matrix than have 8 different variable names.
for k=1:8
A(k,:)=yourCalculationforEachFile;
end

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by