필터 지우기
필터 지우기

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 (최근 30일)
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);

채택된 답변

Guillaume
Guillaume 2014년 11월 13일
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.
  댓글 수: 2
Hana
Hana 2014년 11월 13일
Thanks for the answer...If I want to subtract each Tb cells(only those which meet the condition) by me1,then how can I do the indexing?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by