[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:
> http://octave.1599824.n4.nabble.com/octave-error-in-closing-file-tp4668862p4668878.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
Hi,
you are calling fclose with the file name, but you need to call fclose
with the stream handle fid:
fclose(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
Cheers,
Markus