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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

change 1 d output to 3 d

Asked by Elysi Cochin on 14 Aug 2013

I have a set of color frames. After doing the below steps when i check the size of BB as [r c d] i find d = 1, what should i do to get it as a color value that is d = 3.... Please do reply

    B1 = imread('Frames\1.jpg');
    for i = 2 : numFrames
        display(i);
        B2 = imread(['Frames\',num2str(i),'.jpg']); 
        for x = 1:r
            for n = 1:c
                if n ~= c
                    if B1(x,n+1) == B1(x,n)
                        BB(x,n) = B2(x,n);
                    else
                        BB(x,n) = 0;                    
                    end
                end
            end
        end
    end
    [r c dim] = size(BB)

0 Comments

Elysi Cochin

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 14 Aug 2013
Accepted answer

You do not initialize BB. Every time you write to BB in your code, you do so in two-dimensional form, BB(x,n) . BB is thus going to end up two dimensional (unless c <= 1, in which case BB will not be assigned to at all)

0 Comments

Walter Roberson

Contact us