How to find out if subset of data is or ins't greater than an altered mean value
Ältere Kommentare anzeigen
I have a large matrix with each row representing a data sample and the columns the information of that data sample. Columns 14:37 of the data represent different chlorophyll concentrations for the sample. I need to find out which samples have chlorophyll concentrations greater than 1.5 of the mean in the upper quarter of the sample (so at least one column for that sample between columns 14:19 have a chlorophyll concentration greater than 1.5 of that of the mean chlorophyll concentration (mean of rows 14:37)). The data which does have a chlorophyll concentrations greater than 1.5 of that of the mean in this upper quartile needs to be given a 1 (for yes) and those that don't a 0 (for no). How would I go about doing this?
Thanks,
Natalie
1 Kommentar
Natalie
am 14 Jan. 2014
Akzeptierte Antwort
Weitere Antworten (1)
Mischa Kim
am 14 Jan. 2014
Bearbeitet: Mischa Kim
am 14 Jan. 2014
Hello Natalie,
does this help?
A = [0 1 2;2 3 0;3 0 2]
A =
0 1 2
2 3 0
3 0 2
>> B = A(2:3,:) > 1.5
B =
1 1 0
1 0 1
In the above statement I am comparing all entries in rows 2 and 3 and all columns to 1.5.
2 Kommentare
Natalie
am 14 Jan. 2014
Mischa Kim
am 14 Jan. 2014
data = [0 1 2 3 4 5 6;2 3 2 3 0 0 0;0 0 0 0 0 0 0];
for ii = 1:length(data(:,1))
flag(ii) = double(sum(data(ii,1:6)>1.5*mean(data(ii,:))) > 0);
end
flag_data = [flag' data];
Kategorien
Mehr zu Logical 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!