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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Ian
on 15 Nov 2012

Here's what I have so far (the data set I'm looking at is called static)

%check for marker switching

for i=1:42 %for all columns

for j=1:size(static, i) %for all rows if abs(static (i,j)-static(i,j-1))>5 %if difference is greater then 5 temp=100; %establish temp for ii=i:3:42 %for all columns of the same coordinate if abs(static (ii,j)-static(i,j-1))<temp %search for difference lower then temp temp=abs(static (ii,j)-static(i,j-1)); %if lower replace temp with difference temp_val=static(ii,j); %if lower save value temp_i=ii; %if lower save location end end static(temp_i,j)=static(i,j); %swap values static(i,j)=temp_val; %swap values end end end

*No products are associated with this question.*

## 1 Comment

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/53847#comment_111446

OK. Good luck with that. But you don't need to announce your work here unless you have a question.