MATLAB Answers


Array Comparison

Asked by AP
on 12 Jun 2011

I have two vector V and myFilter. V contains the value of a variable in a 2D domain.

Suppose the 2D domain is a rectangle with the lower left corner (x1,y1) and upper right corner (x2,y2). This domain is discretized by 80 points in x and 60 points in y direction.

The elements of V is written rowwise from the (x1,y1) to (x2,y1) then moves to the next line and put them in the vector V.

My filter is a BW picture named myPicture. myFilter is obtained by myFilter=myPicture(:) which means myPicture is columnwise saved in myFilter.

Is there any efficient way of making V and myFilter consistent with each other so that V(i) and myFilter(i) refers to the same point in the 2D domain?





No products are associated with this question.

1 Answer

Answer by David Young
on 12 Jun 2011


temp = myPicture.';
myFilter = temp(:);


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!