how to access 5 values in an array at a time?
Show older comments
hi everyone...im currently working on an image which i already convert it in terms of its gray level values for pixel by pixel...right now i have problem in accessing the values of those arrays....for example, an image containing 70rows (i=70) and 70columns (j=70)....let say i want to read one whole row first..but i want to read it 5 values at a time, end then the next 5, and then the next until the end...how do i do that???the reason i want to read it bit by bit is because i want to find the average of each 5 gray level values and run a statistical analysis on those averages...
I=imread('1.jpg');
D=double(I(:,:,1));
[i,j]=size(D);
n=0;
k=1;
grayval(1)=0;
for i=25:40
for j=1:40
glevel(j)=D(i,j)
grayval(k+1)=grayval(k)+glevel(j)
n=n+1;
k=k+1;
end
xbar(i)=grayval(k)/n
end
there's something wrong with my code...it returns the average of the whole j...can u please help me??tanx in advance...
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!