MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by FIR on 29 Nov 2012

i have valued as val(:,:,1) 8x8 matrix,,,,,,,,,,,,val(:,:,192)8x8 matrix

now i want to check which all values are nearby ,at a difference of 5 and for that we have to find mean value

suppose val(:,:,1) has mean value of 145.23 and val(:,:,56) has mean of 149.10and val(:,:,103) has mean of 143.05 for all these three we have to find the mean,and so on

please help

*No products are associated with this question.*

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55177#comment_114335

What about values like: 145 148 150 153; the difference between each 2 numbers is<5 but the total difference is 8

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55177#comment_114346

So actually you are talking about the 3D array

val(:,:,n)but you have calculated the mean values already, such that you operate on a vector? Does this mean, that the thread http://www.mathworks.com/matlabcentral/answers/55028-finding-mean-for-values is solved already? If so, please mark mark this thread correspondingly.I still cannot guess, what "val(:,:,1) 8x8 matrix,,,,,,,," exactly means. The notation [8 x 8 x N] is common in Matlab, and a Matlab command as "rand(8, 8, n)" would be clear also.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55177#comment_114367

I know FIR deals with images so maybe val is a color image that is a moving average window, like he's scanned it with a 8x8 window to get the average. But usually windows are an odd number so you don't have a shift of the image in the filtered image vs. the original image like you would for an even window size. But anyway, that's the only thing I can figure out when he says "val(:,:,1) has mean value of 145.23" because an array element by itself can't have an average - it has only its value - so it must be the average of a group of elements. But then I don't know what he means by the mean of all three. Maybe he means (145.23+149.10+143.05)/3 or maybe he wants a weighted average like rgb2gray calculates. But he already knows how to do those things. This question is not clearly explained.