Add constant x,y corrections to array of 2 column s x 4 rows of x,y values.

I.e,
How can I add constant x,y corrections to an array of 2 columns x 4 (or more) rows of x,y values?
Corrections: xc yc
0.007 0.001
Array:
x y
62.579 -80.916
53.5 20.5
-73.5 110.12
-111 -99

 Accepted Answer

A=[62.579 -80.916;53.5 20.5;-73.5 110.12;-111 -99];
xc=0.007
yc=0.001
A(:,1)=A(:,1)+xc
A(:,2)=A(:,2)+yc
%or better
B=bsxfun(@plus,A,[xc,yc])

More Answers (0)

Categories

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!