The index of the largest element in a 2D array in matlab

[v,ind]=max(X);
[v1,ind1]=max(max(X));
disp(['The largest element in X is' num2str(v1) ' at (' num2str(ind(ind1)) ',' num2str(ind1) ')']);

Advertisements

7 Responses to The index of the largest element in a 2D array in matlab

  1. Anonymous says:

    Why calculate max(x) twice? Wouldn’t “[v1,ind1] = max(v)” be more efficient?

  2. Frncesco says:

    [v,ind]=max(max(X(:)));
    [y,x] = ind2sub(size(X),ind);

    do the same 🙂

  3. […] https://chi3x10.wordpress.com/2008/11/12/the-index-of-the-largest-element-in-a-2d-matrix-in-matlab/ VN:F [1.9.20_1166]please wait…Rating: 0.0/10 (0 votes cast)Found it useful? Share this:EmailPrintTwitterMoreFacebookRelated Posts:ezyfit – An Alternative to Matlab’s Curve Fitting ToolboxImage Functions in MatlabUse XML files in Matlab  Posted by Philipp Klaus at 21:13  Tagged with: matlab […]

    • viji says:

      i have a folder of image and have a array of indices of the images in that folder. have to compare the values in the array with the name of the images in the folder. when the match found that images has to be written in another folder. pls any give me some idea to do this. please help me..

  4. WOW just what I was searching for. Came here by searching for
    free picture gallerys of naked women

  5. Sarv says:

    Hi, on occasion I see a 503 website message when I view your page. I thought you may wish to know, regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: