필터 지우기
필터 지우기

How to modify for loop of i and j to get value odd number?

조회 수: 58 (최근 30일)
troy
troy 2013년 5월 1일
I2 = imread('......');
I2 = rgb2gray (I2);
N=8; %N= window size (8x8)
[L,L]=size(I2);
L2=L/N;
S=zeros(L,L);
for i=1:L2
for j=1:L2
S=I2((i-1)*N+1:i*N,(j-1)*N+1:j*N);
theSum(i, j) = sum(S(:));
end;
end;
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 5월 1일
To get which value to be an odd number?
troy
troy 2013년 5월 2일
I mean to access i and j to be odd number. i and j value will calculate odd number only. i=1,i=3,i=5......... j=1,j=3,j=5.........

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2013년 5월 1일
Do you mean, for example,
i=1:2:L2
?
This would loop over i = 1,3,5, ..., L2
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 5월 1일
Ooooo! I think you won today's Crystal Ball Award!
troy
troy 2013년 5월 2일
yes...thanx =)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by