Filter löschen
Filter löschen

I want to calculate the mean of the cells in 3 different images(T1,T2,T3),when the condition applies. each pair of R and T are overlapping and have the same size but T1,T2,T3 have different size

2 Ansichten (letzte 30 Tage)
The cellfun function returns 3 diffrent mean valued for each array..I need a single mean value calculated from all the arrays.
t1=[1 2 3 ; 4 5 6 ; 7 8 9]; t2=[1 2 ;3 4]; t3=[2 3 4 5; 6 7 8 9];
R1=[10 11 10;13 14 12;16 18 12]; R2=[10 15;12 14]; R3=[10 13 17 18;16 14 12 10];
T = {t1,t2,t3}; R={R1,R2,R3};
me1 = cellfun(@(T, R) mean(T(R>=10 & R<12)), T, R); me2 = cellfun(@(T, R) mean(T(R>=12 & R<14)), T, R); me3 = cellfun(@(T, R) mean(T(R>=14 & R<18)), T, R);

Akzeptierte Antwort

Guillaume
Guillaume am 13 Nov. 2014
You would have to concatenate your three filtered arrays before calculating the mean. E.G. for me1:
filtered1 = cellfun(@(T, R) T(R>= 10 & R<12), T, R, 'UniformOutput', false);
me1 = mean(vertcat(filtered{:}));
Same for me2 and me3.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices 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