[Top][All Lists]

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

Re: octave: error in closing file

From: Markus Appel
Subject: Re: octave: error in closing file
Date: Fri, 27 Feb 2015 18:57:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/27/2015 06:31 PM, ubisum wrote:
> here it is:
> --
> View this message in context: 
> Sent from the Octave - General mailing list archive at
> _______________________________________________
> Help-octave mailing list
> address@hidden

you are calling fclose with the file name, but you need to call fclose
with the stream handle fid:

>From your example function, it seems like you want to read a delimited
text file with numbers. This is already implemented in "dlmread", and
usually A=load(file) also does the job.
Otherwise, you could still replace the inner while loop with strtok by
using str2num which can handle entire delimited strings directly:
> octave:5> str2num("3.4\t4.5\t5.6")
> ans =
>    3.4000   4.5000   5.6000


reply via email to

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