Filter löschen
Filter löschen

Where is the second value coming from in this line of code?

1 Ansicht (letzte 30 Tage)
Recap
Recap am 25 Mär. 2016
Kommentiert: Stephen23 am 25 Mär. 2016
Im trying to understand where the "y" is coming from in this line of code.
[x,y]=max(numPlot);
numPlot is an array with 25 numbers. So x is storing the max value from that array but i don't understand what y is storing. Here is an example of numPlot output and what x,y is storing.
numPlot: 1 1 1 1 1 1 5 7 9 6 10 1 10 11 8 9 9 2 5 7 2 2 1 2 1
[x,y]: 11 14
Where did the 14 come from?

Akzeptierte Antwort

John D'Errico
John D'Errico am 25 Mär. 2016
Did you read the help for max? Why not? Surely that should be the very first thing you do when there is a question.
help max
doc max
I imagine there are times when one might wish to know not only what the maximum value was, but where it was located?
  3 Kommentare
Image Analyst
Image Analyst am 25 Mär. 2016
Bearbeitet: Image Analyst am 25 Mär. 2016
In the editor window, you can also put the cursor in the function, or double-click to highlight the function, and hit the F1 key to bring up the documentation on that work.
The 14 means that the max, 11, occurs at element #14.
Stephen23
Stephen23 am 25 Mär. 2016
@Recap: the MATLAB help is very readable, and you can search it using your favorite internet search engine. Learning to read the MATLAB documentation will be the biggest help you can give yourself when using MATLAB

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by