help-octave
[Top][All Lists]
Advanced

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

Re: problem with textread


From: Ben Abbott
Subject: Re: problem with textread
Date: Mon, 23 Jun 2008 21:36:44 -0400


On Jun 23, 2008, at 11:00 AM, george brida wrote:

Hi,
attached the file "bigo.txt".
I used the following syntax
addpath(C:\programfiles)
textread('bigo.txt', %f {,n})


Thank you very much.

If you place the numbers into columns the job is much simpler. See "load" and you'll want to use the -ascii option.

For the file you provided, you can read all the data by

octave:1> fid = fopen ("bigo.txt", "r");
octave:2> data = fscanf (fid, "%f");
octave:3> close (fid)

This will read all the numbers into a single column vector.

octave:4> data
data =

   1.0000e+01
  -1.1230e+01
   1.0060e+01
   1.7280e+01
   1.2130e+01
   1.4020e+01
   1.3010e+01
   1.3008e+02
   1.2270e+01
   1.0000e+01
   1.0080e+01
   1.2000e+01
   1.3280e+01
   2.0000e+01
   1.4110e+01
   1.3050e+01
   1.4100e+01
   5.0000e-04
   2.3200e+01

Will that work for you purpose?

Ben


reply via email to

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