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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:34:25+00:00 2026-05-15T01:34:25+00:00

I have a CSV file, I want to read this file and do some

  • 0

I have a CSV file, I want to read this file and do some pre-calculations on each row to see for example that row is useful for me or not and if yes I save it to a new CSV file.
can someone give me an example?
in more details this is how my data looks like: (string,float,float) the numbers are coordinates.

ABC,51.9358183333333,4.183255
ABC,51.9353866666667,4.1841
ABC,51.9351716666667,4.184565
ABC,51.9343083333333,4.186425
ABC,51.9343083333333,4.186425
ABC,51.9340916666667,4.18688333333333

basically i want to save the rows that have for distances more than 50 or 50 in a new file.the string field should also be copied.
thanks

  • 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-15T01:34:25+00:00Added an answer on May 15, 2026 at 1:34 am

    You could actually use xlsread to accomplish this. After first placing your sample data above in a file 'input_file.csv', here is an example for how you can get the numeric values, text values, and the raw data in the file from the three outputs from xlsread:

    >> [numData,textData,rawData] = xlsread('input_file.csv')
    
    numData =     % An array of the numeric values from the file
    
       51.9358    4.1833
       51.9354    4.1841
       51.9352    4.1846
       51.9343    4.1864
       51.9343    4.1864
       51.9341    4.1869
    
    
    textData =    % A cell array of strings for the text values from the file
    
        'ABC'
        'ABC'
        'ABC'
        'ABC'
        'ABC'
        'ABC'
    
    
    rawData =     % All the data from the file (numeric and text) in a cell array
    
        'ABC'    [51.9358]    [4.1833]
        'ABC'    [51.9354]    [4.1841]
        'ABC'    [51.9352]    [4.1846]
        'ABC'    [51.9343]    [4.1864]
        'ABC'    [51.9343]    [4.1864]
        'ABC'    [51.9341]    [4.1869]
    

    You can then perform whatever processing you need to on the numeric data, then resave a subset of the rows of data to a new file using xlswrite. Here’s an example:

    index = sqrt(sum(numData.^2,2)) >= 50;  % Find the rows where the point is
                                            %   at a distance of 50 or greater
                                            %   from the origin
    xlswrite('output_file.csv',rawData(index,:));  % Write those rows to a new file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file that I want to read with Ruby and create
I have a csv file, and I want to extract the each column a
I have a csv file : 1|1.25 2|23.56 3|58.99 I want to put this
I have a csv file with 5 columns. I want to fetch the row
I want the following functionality using php I have a csv file. Each file
I have this .csv file: ID,GRADES,GPA,Teacher,State 3,C,2,Teacher3,MA 1,A,4,Teacher1,California And what I want to do
I have a time series(a csv file) data that looks like below. Each observation
I have a kind of csv file, with some extra parameters. I don't want
I have a CSV file with 5 sheets. I want to read the second
I have a simple .csv file that has that I want to extract data

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.