Append corresponding values to new matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
AMIT POTE
el 3 de Jul. de 2022
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 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!