how to write this without loop
이전 댓글 표시
hi! i wrote this in matlab:
%
r is a mtrix of the size(25*30000)
for l=1:30000
for k=2:25
d(k,l)=r(k,l)-r(k-1,l);
if d(k,l)<-109
r(k,l)=r(k,l)+300;
elseif d(k,l)>180
r(k,l)=r(k,l)-300;
end
end
end
how could write this with minimal loops?
thank you
채택된 답변
추가 답변 (1개)
Walter Roberson
2013년 3월 1일
0 개 추천
You can start with diff(r), and then use logical indexing.
카테고리
도움말 센터 및 File Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!