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!