element mean of matrices
2 次查看(过去 30 天)
显示 更早的评论
I have 5 matrices of 20*20 size, i want to calculate mean of each element. But i am trying to ommit the least values like <15% from Maximum of each element (i.e if there is any value <15%of maximum on each element of 5 matrices). Plz suggest the process and code
回答(1 个)
KSSV
2019-3-18
编辑:KSSV
2019-3-18
A = rand(5,5,7) ; % some random data for demo
iwant = zeros(7,1) ; % initialize the required
for i = 1:7
Ai = A(:,:,i) ; % the present mtrix
A_max = max(Ai(:)) ; % get max of the matrix
idx = Ai<15/100*A_max ; % get indices less then 15% of the max
iwant(i) = mean(Ai(idx)) ; % get mean
end
You may do this without defining those many variables. For your understanding I have used the extra variables.
另请参阅
类别
在 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!