Append corresponding values to new matrix

조회 수: 1 (최근 30일)
MadjeKoe
MadjeKoe 2022년 6월 15일
답변: AMIT POTE 2022년 7월 3일
Hi guys, I am trying to append accuracy values of the rows that match the statement into a list. In my r matrix there are 28 participants each performing 5 blocks of 120 trials. Per trial (600 in total), I want to store every accuracy value. So for example, when block == 1 and trials == 1, I want to append all 56 corresponding accuracy scores. Is there anyone who can help me out?
r(:,14) = accuracy;
sd = zeros(5,120);
for b = 1:5
for s = 1:120
if r(:,3) == b & r(:,4) == s
sd = accuracy(s,1)
end
end
end

답변 (1개)

AMIT POTE
AMIT POTE 2022년 7월 3일
You can append new values to a newly created array using end operator. For ex:
If suppose your accuracy array is accuracy_arr, then you can write the following code to append values:
accuracy_arr = {}
accuracy_arr = [accuracy_arr new_val]
To know more about this you can go through the documentation:

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by