element mean of matrices
    6 views (last 30 days)
  
       Show older comments
    
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
2 Comments
Answers (1)
  KSSV
      
      
 on 18 Mar 2019
        
      Edited: KSSV
      
      
 on 18 Mar 2019
  
      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. 
1 Comment
See Also
Categories
				Find more on Creating and Concatenating Matrices in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

