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
1 回表示 (過去 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);
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!