Append corresponding values to new matrix
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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:
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!