×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Textread

Textread

Textread

(OP)
I'm sure that this will be a quite simple question, but I will not work for me. I try to read data from a csv-file (see under post). But is doesn't work... I try to skip the the first 9 ninen lines, because they are useless for the data analyses. I try the following line with matlab:
[data] = textread('data.csv','','delimiter',',','emptyvalue',NaN)

Can somebody help me to change this line? Thanks for every help!

greetings,
Erik

0;63;1;63;500;1000;0;4
 0;1;1;150;1000;1500
 0;2;2;150;1000;1500
 0;3;3;150;1000;1500
 0;4;4;150;1000;1500
 0;5;5;150;1000;1000
 0;6;6;150;1000;1000
 0;7;7;150;1000;1000
 0;8;8;150;1000;1000
  1; 2; 792;2314; Led;-255;   3;    2; 1500;   7;   1; NaN; NaN
  2; 2; 892; 892; Led;-255;   6;    1; 1500;   7;   1; NaN; NaN
  3; 2; 835; 835; Led;-255;   9;    1; 1500;   7;   1; NaN; NaN
  4; 2; 881; 881; Led;-255;  12;    1; 1500;   7;   1; NaN; NaN
  5; 2; 560; 560; Led;-255;  15;    1; 1500;   7;   1; NaN; NaN
  6; 2; 507; 507; Led;-255;  18;    1; 1500;   7;   1; NaN; NaN
  7; 2; 652; 652; Led;-255;  21;    1; 1500;   7;   1; NaN; NaN
  8; 2; 704; 704; Led;-255;  24;    1; 1500;   7;   1; NaN; NaN
  9; 2; 502; 502; Led;-255;  27;    1; 1500;   7;   1; NaN; NaN
 10; 2; 738;1495; Led;-270;   3;    2; 1500;   7;   1; NaN; NaN
 11; 2; 901; 901; Led;-270;   6;    1; 1500;   7;   1; NaN; NaN
 12; 2; 767; 767; Led;-270;   9;    1; 1500;   7;   1; NaN; NaN
 13; 2; 940; 940; Led;-270;  12;    1; 1500;   7;   1; NaN; NaN
 14; 2; 852; 852; Led;-270;  15;    1; 1500;   7;   1; NaN; NaN
 15; 2; 848; 848; Led;-270;  18;    1; 1500;   7;   1; NaN; NaN
 16; 2; 853; 853; Led;-270;  21;    1; 1500;   7;   1; NaN; NaN
 17; 2; 546; 546; Led;-270;  24;    1; 1500;   7;   1; NaN; NaN
 18; 2; 521; 521; Led;-270;  27;    1; 1500;   7;   1; NaN; NaN
 19; 2; 655;1494; Led;-285;   3;    2; 1500;   7;   1; NaN; NaN
 20; 2; 661; 661; Led;-285;   6;    1; 1500;   7;   1; NaN; NaN
 21; 2; 901; 901; Led;-285;   9;    1; 1500;   7;   1; NaN; NaN
 22; 2; 707; 707; Led;-285;  12;    1; 1500;   7;   1; NaN; NaN
 23; 2; 569; 569; Led;-285;  15;    1; 1500;   7;   1; NaN; NaN
 24; 2; 819; 819; Led;-285;  18;    1; 1500;   7;   1; NaN; NaN
 25; 2; 777; 777; Led;-285;  21;    1; 1500;   7;   1; NaN; NaN
 26; 2; 886; 886; Led;-285;  24;    1; 1500;   7;   1; NaN; NaN
 27; 2; 544; 544; Led;-285;  27;    1; 1500;   7;   1; NaN; NaN
 28; 2; 567;1492; Led;   0;   3;    2; 1500;   7;   1; NaN; NaN
 29; 2; 893; 893; Led;   0;   6;    1; 1500;   7;   1; NaN; NaN
 30; 2; 834; 834; Led;   0;   9;    1; 1500;   7;   1; NaN; NaN
 31; 2; 702; 702; Led;   0;  12;    1; 1500;   7;   1; NaN; NaN
 32; 2; 942; 942; Led;   0;  15;    1; 1500;   7;   1; NaN; NaN
 33; 2; 673; 673; Led;   0;  18;    1; 1500;   7;   1; NaN; NaN
 34; 2; 917; 917; Led;   0;  21;    1; 1500;   7;   1; NaN; NaN
 35; 2; 767; 767; Led;   0;  24;    1; 1500;   7;   1; NaN; NaN
 36; 2; 543; 543; Led;   0;  27;    1; 1500;   7;   1; NaN; NaN
 37; 2; 766;1494; Led;  15;   3;    2; 1500;   7;   1; NaN; NaN
 38; 2; 603; 603; Led;  15;   6;    1; 1500;   7;   1; NaN; NaN
 39; 2; 858; 858; Led;  15;   9;    1; 1500;   7;   1; NaN; NaN
 40; 2; 704; 704; Led;  15;  12;    1; 1500;   7;   1; NaN; NaN
 41; 2; 840; 840; Led;  15;  15;    1; 1500;   7;   1; NaN; NaN
 42; 2; 625; 625; Led;  15;  18;    1; 1500;   7;   1; NaN; NaN
 43; 2; 795; 795; Led;  15;  21;    1; 1500;   7;   1; NaN; NaN
 44; 2; 649; 649; Led;  15;  24;    1; 1500;   7;   1; NaN; NaN
 45; 2; 928; 928; Led;  15;  27;    1; 1500;   7;   1; NaN; NaN
 46; 2; 526;1492; Led;  30;   3;    2; 1500;   7;   1; NaN; NaN
 47; 2; 793; 793; Led;  30;   6;    1; 1500;   7;   1; NaN; NaN
 48; 2; 964; 964; Led;  30;   9;    1; 1500;   7;   1; NaN; NaN
 49; 2; 825; 825; Led;  30;  12;    1; 1500;   7;   1; NaN; NaN
 50; 2; 513; 513; Led;  30;  15;    1; 1500;   7;   1; NaN; NaN
 51; 2; 698; 698; Led;  30;  18;    1; 1500;   7;   1; NaN; NaN
 52; 2; 957; 957; Led;  30;  21;    1; 1500;   7;   1; NaN; NaN
 53; 2; 817; 817; Led;  30;  24;    1; 1500;   7;   1; NaN; NaN
 54; 2; 843; 843; Led;  30;  27;    1; 1500;   7;   1; NaN; NaN
 55; 2; 646;1493; Led;  45;   3;    2; 1500;   7;   1; NaN; NaN
 56; 2; 742; 742; Led;  45;   6;    1; 1500;   7;   1; NaN; NaN
 57; 2; 745; 745; Led;  45;   9;    1; 1500;   7;   1; NaN; NaN
 58; 2; 686; 686; Led;  45;  12;    1; 1500;   7;   1; NaN; NaN
 59; 2; 790; 790; Led;  45;  15;    1; 1500;   7;   1; NaN; NaN
 60; 2; 620; 620; Led;  45;  18;    1; 1500;   7;   1; NaN; NaN
 61; 2; 681; 681; Led;  45;  21;    1; 1500;   7;   1; NaN; NaN
 62; 2; 667; 667; Led;  45;  24;    1; 1500;   7;   1; NaN; NaN
 63; 2; 988; 988; Led;  45;  27;    1; 1500;   7;   1; NaN; NaN


RE: Textread

Hi,

try this :

[M{1:13}]=textread('data.csv', ...
'%d%d%d%d%s%d%d%d%d%d%d%d%d', ...
'headerlines',9, ...
'delimiter',';')

Jérôme

RE: Textread

(OP)
Thanks man, it doesn't give any errors! :D But there is second question, I want to use it... I get the following information of M:

Quote:

M =

  Columns 1 through 7

    [63x1 double]    [63x1 double]    [63x1 double]    [63x1 double]    {63x1 cell}    [63x1 double]    [63x1 double]

  Columns 8 through 13

    [63x1 double]    [63x1 double]    [63x1 double]    [63x1 double]    [63x1 double]    [63x1 double]

But simply use of M(:,1) doesn't show the first collumn, but:
[63x1 double]. So I want to see the contents

RE: Textread

(OP)
Thanks for your quick answer, it works :) Great and I will read the text!

greetings,
Erik

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources