help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: textread issue


From: Markus Bergholz
Subject: Re: textread issue
Date: Mon, 10 Jun 2013 21:15:12 +0200




On Mon, Jun 10, 2013 at 9:03 PM, PhilipNienhuis <address@hidden> wrote:
snaucler wrote
> I am using Octave-3.6.4 vs2010.  have recently (last week) installed the
> I/O package.
>
> I am trying to read data from a csv file. Below is a snippet of that file
> I am currently working with.
>
> Chan ID,Chann Name,Slope,Offset
> R01,Blade 1 Edge,1.234,4.567
> R02,Blade 1 Flap,2.345,5.678
> R03,Blade 2 Edge,3.456,6.789



octave:1> system('cat help.txt')
Chan ID,Chann Name,Slope,Offset
R01,Blade 1 Edge,1.234,4.567
R02,Blade 1 Flap,2.345,5.678
R03,Blade 2 Edge,3.456,6.789
ans = 0
octave:2> f=fopen('help.txt')
f =  3
octave:3>  textscan(f,'%s %s %f %f','delimiter',',','HeaderLines',1)
ans = 
{
  [1,1] = 
  {
    [1,1] = R01
    [2,1] = R02
    [3,1] = R03
  }
  [1,2] = 
  {
    [1,1] = Blade 1 Edge
    [2,1] = Blade 1 Flap
    [3,1] = Blade 2 Edge
  }
  [1,3] =

     1.2340
     2.3450
     3.4560

  [1,4] =

     4.5670
     5.6780
     6.7890

}
octave:4> fclose(f)
ans = 0





 
>
>  Here is the line of code I am using:
> chanName = textread('Cal_Spreadsheet.csv','%s %s %d
> %d','delimiter',',','headliner',1)

"headliner" ?  make that "headerlines" and try again.

In addition I suspect you might need "whitespace", ""  in the argument list
as well (not sure).

BTW your example becomes much more readable if you add a few spaces here and
there, e.g. between arguments and between function name and parens.

Philip




--
View this message in context: http://octave.1599824.n4.nabble.com/textread-issue-tp4653985p4653988.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



--
icq: 167498924
XMPP|Jabber: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]