# How to count up matrix values for specific number of positions specified by other matrix?

1 Ansicht (letzte 30 Tage)
Rene Sebena am 29 Jun. 2016
Kommentiert: Moe_2015 am 29 Jun. 2016
Hi there,
I am trying to solve this task, I have matrix with Experimental Conditions eg:
A =
10 12 13 13 13
13 10 14 16 14
10 11 12 12 14
9 14 10 16 14
10 9 15 14 12
12 13 9 15 10
and corresponding accuracy matrix with logical values 1 (for the correct responses) and 0 (for incorrect responses), eg:
B =
1 1 0 0 0
1 1 1 0 1
1 0 0 1 1
1 1 1 0 1
0 0 1 1 1
1 0 0 1 1
What I need to do, is to count up correct trials for eg. first five trials within experimental condition "10" (ordered in columns, so first count 1st column then 2nd etc..) so in this case the 5th experimental condition "10" is located in A(4,3) and so the result would be 4.
Thank you very much in advance.
Rene
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Moe_2015 am 29 Jun. 2016
You can do this:
experiment_10=find(A==10);
first_five_trials=B(experiment_10(1:5));
correct_trials=sum(first_five_trials)
##### 2 KommentareKeine anzeigenKeine ausblenden
Rene Sebena am 29 Jun. 2016
Thank you!
Moe_2015 am 29 Jun. 2016
No problem!

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by