Append corresponding values to new matrix

2 visualizzazioni (ultimi 30 giorni)
MadjeKoe
MadjeKoe il 15 Giu 2022
Risposto: AMIT POTE il 3 Lug 2022
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

Risposte (1)

AMIT POTE
AMIT POTE il 3 Lug 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:

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by