Need help to solve following problem.

조회 수: 3 (최근 30일)
Prabhath Manuranga
Prabhath Manuranga 2024년 3월 12일
댓글: Prabhath Manuranga 2024년 3월 12일
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

답변 (1개)

VBBV
VBBV 2024년 3월 12일
편집: VBBV 2024년 3월 12일
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

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by