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

  • Home
  • SEARCH
  • 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 8611475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:23:08+00:00 2026-06-12T04:23:08+00:00

I am having a .csv file which contains let’s say 50 rows. At the

  • 0

I am having a .csv file which contains let’s say 50 rows.

At the beginning of each row I have a file name in the following format 001_02_03.bmp followed by values separated by commas. Something like this :

001_02_03.bmp,20,30,45,10,40,20

Can someone tell me how can I read the first column from the data?

I know how to obtain the data from the second column onward. I am using the csvread function like this X = csvread('filename.csv', 0, 1);. If I try to read the first column in the same manner it outputs an error, saying the csvread does not support string format.

  • 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-06-12T04:23:10+00:00Added an answer on June 12, 2026 at 4:23 am

    Use textscan, ie:

    fid1 = fopen(csvFileName);
    X = textscan(fid1, '%s%f%f%f%f%f%f', 'Delimiter', ',');
    fclose(fid1);
    FirstCol = X{1, 1};
    

    A little more detail? csvread only works with purely numeric data, so you can’t use it to get in data with a .bmp, or underscores for that matter. Thus we use textscan. The funny looking format string input to textscan is just saying that the columns are, in order, of type string %s, then the next 6 columns are of type double %f%f%f%f%f%f (or you might choose to alter this to reflect an integer datatype – I personally rarely bother unless the quantity of data is huge or floating point precision is a problem).

    Note, if you just wanted to get the first column and ignore the rest, you can replace the format string with %s% %*[^\n]. A final point, if your csv file has a header line, you can skip it using the HeaderLines optional input to textscan.

    • 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 where each row defines a room in a given
I have some code which reads every row of a CSV file and if
I have following script which processes emails and save them to csv file. there
I have unpredictable frequency of Incoming csv data file which I need to store
I have a UTF-16 CSV file which I have to read. Python csv module
I have an array which holds a record from a CSV file. Can I
I am having to code up a button which, onclick, downloads a csv file
for my application i have to parse CSV file using Erlang.following is the code
I have idsfile.csv which is a comma separated file of ids (with no new
My goal is to take in a CSV file which contains approximately 4 million

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.