Maximum and Minimum values of a field structure array
5 次查看(过去 30 天)
显示 更早的评论
Hi, I have structure array as shown in the image below. How can i find the maximum and minimum population with the corresponding state for the available data.
Thanks in advance.
0 个评论
回答(1 个)
Birdman
2020-4-2
%find max and min population
[Cmax,maxIdx]=max(AustralianStates.Population)
[Cmin,minIdx]=min(AustralianStates.Population)
%find corresponding state
AustralianStates.Name([minIdx maxIdx])
%find corresponding land area
AustralianStates.Land_Area([minIdx maxIdx])
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!