Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7434767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:56:49+00:00 2026-05-29T09:56:49+00:00

If I had a matrix A such as: 63 55 85 21 71 80

  • 0

If I had a matrix A such as:

63    55    85    21    71
80    65    85    48    53
55    60    93    71    66
21    65    40    33    21
61    90    80    48    50

… and so on how would I find the minimum values of each column and remove those numbers from the matrix completely, meaning essentially I would have one less row overall.

I though about using:

[C,I] = min(A);

A(I) = [];

but that wouldn’t remove the necessary numbers, and also reshape would not work either. I would like for this to work with an arbitrary number of rows and columns.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:56:50+00:00Added an answer on May 29, 2026 at 9:56 am
    A  = [
    63    55    85    21    71
    80    65    85    48    53
    55    60    93    71    66
    21    65    40    33    21
    61    90    80    48    50
    ];
    
    B = zeros( size(A,1)-1, size(A,2));
    for i=1:size(A,2)
        x = A(:,i);
        maxIndex = find(x==min(x(:)),1,'first');
        x(maxIndex) = [];
        B(:,i) = x;
    end
    disp(B);
    

    Another vectorized solution:

    M = mat2cell(A,5,ones(1,size(A,2)));
    z = cellfun(@RemoveMin,M);
    B = cell2mat(z);
    disp(B);
    
    function x = RemoveMin(x)
        minIndex = find(x==min(x(:)),1,'first');
        x(minIndex) = [];
        x = {x};
    end
    

    Another solution:

    [~,I] = min(A);
    indexes = sub2ind(size(A),I,1:size(A,2));
    B = A;
    B(indexes) = [];
    out = reshape(B,size(A)-[1 0]);
    
    disp(out);
    

    Personally I prefer the first because:

    1. For loops aren’t evil – many times they are actually faster (By using JIT optimizer)
    2. The algorithm is clearer to the developer who reads your code.

    But of course, its up to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say that I had a matrix of temperature values and a vector corresponding to
blkdiag uses varargin to construct a block diagonal matrix from the input arguments (each
I have a matrix of data (with row names and column names). I would
I want to sum all elements of matrix in Matlab. If I had a
I have some data represented in a 1300x1341 matrix. I would like to split
I had a generalized question to find out if it was possible or not
From discussions I've had about language design, it seems like a lot of people
I am trying to plot a matrix where each element is in one out
This is a question that came from an earlier problem I had . Basically,
I had created a small app such that the image which is displaying should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.