Sequential reading of an array using loop
1 回表示 (過去 30 日間)
古いコメントを表示
Hello!!
How to sequentially read arrays and apply an operation. e.g. I am having two arrays of Latitudes,Longitudes, and Altitudes.
lat=[27.692612,27.690227,27.696509]
lon=[85.342982,85.342576,85.33567]
alt=[100,95,90]
Using a loop, I want to apply anoperation to every entry of lat, lon, alt e.g. converting these latitudes, longitudes, altitudes to ECEF using "lla2ecf" function
[X1,Y1,Z1]=lla2ecef(Lat(1),lon(1),alt(1));
[X2,Y2,Z2]=lla2ecef(Lat(2),lon(2),alt(1));
.
.
.
[Xn,Yn,Zn]=lla2ecef(Lat(end),lon(end),alt(end));
0 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 12 月 16 日
You can use arrayfun(), which is essentially an implicit for-loop
lat=[27.692612,27.690227,27.696509]
lon=[85.342982,85.342576,85.33567]
alt=[100,95,90]
[X, Y, Z] = arrayfun(@lla2ecef, lat, lon, alt)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!