MATLAB Answers

Store values from a for loop into a matrix

4 ビュー (過去 30 日間)
Jo E.
Jo E. 2019 年 9 月 22 日
編集済み: Jo E. 2019 年 9 月 22 日
Hello all, if anyone could possibly help me I would greatly appreciate it. I am attempting to store values calculated in a for loop in a matrix. I have already tried to preallocate arrays and create an empty matrix but just cant seem to get it to work.
The matrix would be [65x3] because there are 3 conditions and 65 participants. The for loop calculates one condition from one participant at a time.
for RARs = zeros(65, 3)
i = 1:65;
RARatio = AUC/RA;
disp(RARatio)
% RAR Matrix
RARmat(RARs, :) = RARatio;
end
Thank you in advance!

  0 件のコメント

サインイン to comment.

採用された回答

madhan ravi
madhan ravi 2019 年 9 月 22 日
RARmat = zeros(65, 3)
for ii = 1:65
RARatio = AUC/RA;
disp(RARatio)
% RAR Matrix
RARmat(ii, :) = RARatio;
end

  11 件のコメント

表示 8 件の古いコメント
Jo E.
Jo E. 2019 年 9 月 22 日
Yes and you answered it wonderfully. I asked the follow up question of how to store values of each itiration in a new row after the 3rd iteration. Thank you for your help thus far.
madhan ravi
madhan ravi 2019 年 9 月 22 日
You would be better off starting a new question (also link this thread to that question), so that you get a help soon.
Jo E.
Jo E. 2019 年 9 月 22 日
Will do. Thank you for your help.

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。


Translated by