Accumarray error: First input SUBS must contain positive integer subscripts.
Ältere Kommentare anzeigen
Hello,
The accumarray function is causing me problems - the error is embedded within the question. Attached you find a sample file and below you find the piece of code I wrote:
temp_raw_JE50=X0012_50(:,20)-X0012_50(:,17); % raw overall JE50
temp_AO50=ismember(X0012_50(:,13),0); % AO trials (0's) in col. 13 of temp_file_50
temp_raw_JE50AO= accumarray(temp_raw_JE50,temp_AO50); % raw JE50 for AO trials only
Could you please be so kind as to help me?
Bianca
Akzeptierte Antwort
Weitere Antworten (1)
Andrei Bobrov
am 28 Jun. 2016
[uval,~,subs] = unique(X0012_50(:,20)-X0012_50(:,17));
temp_raw_JE50AO = accumarray(subs,~X0012_50(:,13));
out = [uval, temp_raw_JE50AO];
4 Kommentare
Bianca Elena Ivanof
am 28 Jun. 2016
Andrei Bobrov
am 28 Jun. 2016
uval, subs - variable.
out - the calculation result
Bianca Elena Ivanof
am 29 Jun. 2016
Sean de Wolski
am 30 Jun. 2016
Look at the documentation for examples and descriptions of what the pieces are:
doc unique
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!