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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:36:23+00:00 2026-05-29T12:36:23+00:00

I have just started learning MATLAB and have difficulties to import csv files to

  • 0

I have just started learning MATLAB and have difficulties to import csv files to a 2-D array..

Here is a sample csv for my needs:(all the csv files are in the same format with fixed columns)

Date,                Code,         Number....
2012/1/1,            00020.x1,             10
2012/1/2,            00203.x1,            0300
...

As csvread() only works with integer numbers, should I import numeric data and text data separately or is there any quick way to import multiple csv files with mixed data types?

Thanks a lot!!

  • 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-29T12:36:25+00:00Added an answer on May 29, 2026 at 12:36 pm

    What you’re looking for is maybe the function xlsread.

    It opens any file recognized by Excel, and automatically separates text data from numerical data.

    The problem is that the default delimiter for at least on my computer is ;, and not , (at least for my locale here in Brazil). So xlsread will try to separate the fields on the file with a ;, and not a comma as you’d like.

    To change that you have to change your system locales to add the comma as the list separator. So if you feel like it, to do it in windows vista, click Start, Control Panel, Regional and Language Options, Customize this format, and change the List Separator from ‘;’ to ‘,’. On other windows the process should be almost the same.

    After doing that, typing:

    [num, txt, all] = xlsread('your_file.csv');
    

    will return something like:

    num =
    
    10
    300
    
    
    txt = 
    
    '01/01/2012'    ' 00020.x1'
    '02/01/2012'    ' 00203.x1'
    
    
    all = 
    
    '01/01/2012'    ' 00020.x1'    [ 10]
    '02/01/2012'    ' 00203.x1'    [300]
    

    Notice that if your locale has already the list separator set to ‘,’, you won’t have to change anything on your system to make that work.

    If you don’t want to change your system just to use the xlsread function, then you could use the textscan function described here: http://www.mathworks.com/help/techdoc/ref/textscan.html

    The problem is that it is not as simple as calling it, as you will have to open the file, iterate on the lines, and tell matlab explicitly the format of your file.

    Best regards

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

Sidebar

Related Questions

I have just started learning pthreads API and I am following the tutorial here
I have just started learning PHP, and here's my first doubt... Both of these
I have just started learning Erlang and am trying out some Project Euler problems
I have just started learning Jquery and am new to writing javascript (I am
I have just started learning MVVM and having a dilemna. If I have a
I have just started learning NHibernate. Over the past few months I have been
I have just started writing my own JavaScript Framework (just for the learning experience),
I have just started learning Lucene and would like to use it for indexing
I have just started learning CXF. I made a maven archetype project through eclipse.
I have just started learning ruby on rails. I have a doubt wrt routing.

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.