# Using MAX function to determine which year had the highest value

2 visualizzazioni (ultimi 30 giorni)
CassieK il 27 Nov 2020
Risposto: Andrei Bobrov il 27 Nov 2020
I have this data here that I have put into a table:
INPUT
years ace tropical_storms hurricanes major_hurricanes
_____ ___ _______________ __________ ________________
1950 243 13 11 8
1951 137 10 8 5
1952 87 7 6 3
1953 104 14 6 4
1954 113 11 8 2
1955 199 12 9 6
1956 54 8 4 2
1957 84 8 3 2
1958 121 10 7 5
1959 77 11 7 2
1960 88 7 4 2
I need to use tha max function to determine which year has the highest number of tropical storms.
DESIRED OUTPUT
Max =
1953 14
MATLAB Version: 9.8.0.1417392 (R2020a) Update 4
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Andrei Bobrov il 27 Nov 2020
out = T(max(T.tropical_storms) == T.tropical_storms,:)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Sulaymon Eshkabilov il 27 Nov 2020
Create just a matrix array of your data, e.g. A = [...; ....];
Atab = array2table(A, 'VariableNames', {'Years', 'Ace', 'Tropical_st', 'Hurricanes', 'Major_Hurricanes'});
[Values, Rows]=max(Atab.Tropical_st);
ANS = Atab(Rows,:) % Get the complete answer
Year_ans = Atab(Rows,1) % Get the YEAR answer
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
CassieK il 27 Nov 2020
Imported the data file and created a matrix(acedata). Is there something else I'm missing that I'm getting this error?

Accedi per commentare.

### Categorie

Scopri di più su Logical in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by