Maximum and Minimum values of a field structure array

14 views (last 30 days)
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.

Answers (1)

Birdman
Birdman on 2 Apr 2020
%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])
  8 Comments
Rishitha Muchinthala
Rishitha Muchinthala on 3 Apr 2020
Thank you,
Akira's second code is working.
I got the result.

Sign in to comment.

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by