Need help to solve following problem.

5 views (last 30 days)
X_ISMD = 995152.969208341;
Y_ISMD = 996113.117131325;
for i = 1:length(data1)
D1(i) = sqrt((X_ISMD - X_WGS84(i)).^2 + (Y_ISMD - Y_WGS84(i)).^2);
end
D1
length(data1) is 172. X_WGS84(i) and Y_WGS84(i) are 172 by 1 matrix. according to the above matlab code i ma getting following output (1 by 172 matrix). but i want to have 172 by 1 matrix. could you please suggest where should i change in my code? Thanks.
D1 =
Column 1
140911.995295475
Column 2
123232.133401588
Column 3
115208.35805542
Column 4
93127.1628328772

Accepted Answer

VBBV
VBBV on 12 Mar 2024
Edited: VBBV on 12 Mar 2024
X_ISMD = 995152.969208341;
Y_ISMD = 996113.117131325;
X_WGS84 =randn(172,1);
Y_WGS84 =randn(172,1);
for i = 1:172
D1(i) = sqrt((X_ISMD - X_WGS84(i)).^2 + (Y_ISMD - Y_WGS84(i)).^2);
end
D1 = D1.' % Transpose
D1 = 172×1
1.0e+06 * 1.4080 1.4080 1.4080 1.4080 1.4080 1.4080 1.4080 1.4080 1.4080 1.4080

More Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!