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 6143097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:28:38+00:00 2026-05-23T18:28:38+00:00

I have a huge set of data in Excel file sheet 1. The number

  • 0

I have a huge set of data in Excel file sheet 1. The number of columns is fixed (6) but there are lots of rows.

For every 3 rows, I need to pick out the minimum value of 2nd column and save the whole row into Excel file or sheet 2, how am I going to write the script?

item.xls (sheet 1):

0.3 0.5 0.1 0.8 0.4 0.6
0.2 0.4 0.9 0.1 0.9 0.4
0.2 0.3 0.1 0.01 0.2 0.5
0.3 0.5 0.1 0.8 0.01 0.2
0.2 0.2 0.9 0.1 0.2 0.4
0.2 0.3 0.1 0.01 0.3 0.5
.......

In the first 3 rows, the minimum value of 2nd column is 0.3, then write the whole row into sheet 2 of the Excel file.

Then the next 3 rows, the minimum value of 2nd column is 0.2, then write the whole row into sheet 2 of the Excel file.

The result I would like to get is:

item.xls (sheet2):

0.2 0.3 0.1 0.01    % 1st 3 rows, the minimum value is 0.3 in 2nd column
0.2 0.2 0.9 0.1     % 2nd set of 3 rows, the minimum value is 0.2 in 2nd column
...
  • 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-23T18:28:38+00:00Added an answer on May 23, 2026 at 6:28 pm

    I will show how to extract the relevant rows from the data in a vectorized manner. I will leave the part of reading/writing excel files to you (it should be straightforward):

    %# sample data
    data = rand(3*10,6);
    
    %# for each three rows, find the min of second column, and get the row index
    [r c] = size(data);
    d = permute(reshape(data',[c 3 r/3]),[2 1 3]);  %'# split into third dimension
    [~,idx] = min(d(:,2,:));                        %# find min of col2
    idx = squeeze(idx) + (0:3:(r-1))';              %'# adjust indices
    
    %# extract these rows from the data matrix
    result = data(idx,:);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have huge set of data in an excel file in the following format
I have a huge data set and I have to compute for every point
I have an excel sheet which has some huge data. Data is organized as
I have a huge C++ codebase. On a certain set of data there's a
I have a huge data set and I want to extract the rows which
I have a huge set of data and want to display the data with
I have a selection of a huge set of data and I would like
I have a huge set of data of tables in Open Office 3.0 document
Here is the situation: I have a huge data set that I need quick
I have a huge data set. The structure looks something like this: K_Field1, K_Field2,

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.