Need help to solve following problem.

2 visualizzazioni (ultimi 30 giorni)
Prabhath Manuranga
Prabhath Manuranga il 12 Mar 2024
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

Risposte (1)

VBBV
VBBV il 12 Mar 2024
Modificato: VBBV il 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

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by