MATLAB Answers


I am trying to construct a matlab code that will identify marker switching in motion capture, then search through the other markers in the same frame and identify the other switched marker, then switch them back.

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
            static(temp_i,j)=static(i,j);           %swap values
            static(i,j)=temp_val;                   %swap values

  1 Comment

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


No products are associated with this question.

0 Answers

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!