I know that this question has been answered a lot of times in this forum but I am a beginner in MATLAB and I was not able to find a suitable solution for myself.
The index value is correct when used as: Variable(K)
Image Analyst's approach is also correct, but assumes you want the max of each column, and his indexAtMax is also correct, when used as Variable(indexAtMax(column_number),column_number)
He showed one dimensional data in his screenshot, not 2D data. That's why I didn't use (:). Plus the values will be the same no matter if the 1D data is a row vector or a column vector. A row vector will not give you the value of each column back - it will give you the max like you expect. If someone has a 2D matrix and want the overall matrix then (:) is correct. Of course it will also work with 1D arrays as well though it's not necessary.
Sure does. But he provides some conflicting information. Rick says the variable has size (2075,196). My guess was the plot is not very informative, and that he meant to usesurf() or the likes.
Oh well, if all questions were cristal clear, I guess it would take away some of the fun. It would make answering questions more efficient though, removing the guessing part.
Could you explain why the alternatives proposed here do not fit the bill? The data and the plot don't explain things, at least no to me. What do you mean by maxima? Image Analyst answer gives you the maximum for every column of data. Iain and me give you the maximum for the entire matrix. I cannot think of another maximum.
I haven't downloaded the data yet, but if it is a 2D array, thenwhat are you plotting? Justone of the columns or one of the rows? Or you just plotted the whole thing and were unaware of what it would plot? What do youwant to plot? A row or a column, or both, perhaps with surf() or waterfall()?
First of all I would like to apologise for my mistake. The data is indeed a two dimensional data with 2705 rows and 196 column. The graph that I am plotting is like a maxima of each column. So there are some columns where all the values are zero and some columns where I get some values which are plotted.
I still do not understand I am plotting 2d data with simple plot command. I am using MATLAB version R 2013a.
Then you get the maximums with what Image Analyst suggested. Please look at the documentation formax().
If you want the row, columns of each column maximum, then you need to transform the linear indexes to subindexes. Please look atind2sub().
If you want to plot a surface (2d data) then you can't useplot(). Please look at the documentation forsurf(). There you will find links to similar plotting tools, that could also work.
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Translated by
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.