[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new function: textscan.m
From: |
John W. Eaton |
Subject: |
Re: new function: textscan.m |
Date: |
Sat, 23 Oct 2010 02:13:12 -0400 |
On 22-Oct-2010, Michael D Godfrey wrote:
| On 10/22/2010 10:47 PM, John W. Eaton wrote:
|
| Ah, good idea, I had forgotten about that feature. I'll check in the
| follwoing function:
|
| function retval = is_valid_file_id (fid)
|
| retval = false;
|
| if (nargin == 1)
| try
| [file, mode, arch] = fopen (fid);
| retval = ! isempty (file);
| end_try_catch
| else
| print_usage ();
| endif
|
| endfunction
|
| Thanks,
|
| jwe
|
| Just a question: is there any need to do an fclose(fid) after the
| fopen(fid) ?
No, this usage of fopen just checks the status of FID. It doesn't
actually open a file. Or at least it is not supposed to. But I see
now that there is no check on nargout in fopen, and the way the logic
is for handling the (stupid Matlab compatible) fopen ("all") case,
something like
[file, mode, arch] = fopen ("file")
will actually open "file" for reading if it exists. I'll fix that so
that if nargout == 3 and nargin == 1, we will only perform the status
check.
jwe
- Re: new function: textscan.m, (continued)
- Re: new function: textscan.m, John W. Eaton, 2010/10/22
- Re: new function: textscan.m, Ben Abbott, 2010/10/23
- Re: new function: textscan.m, John W. Eaton, 2010/10/23
- Re: new function: textscan.m, Ben Abbott, 2010/10/23
- Re: new function: textscan.m, John W. Eaton, 2010/10/23
- Re: new function: textscan.m, John W. Eaton, 2010/10/22
- Re: new function: textscan.m, Michael D Godfrey, 2010/10/22
- Re: new function: textscan.m, Ben Abbott, 2010/10/23
- Re: new function: textscan.m, John W. Eaton, 2010/10/23
- Re: new function: textscan.m, Michael D Godfrey, 2010/10/23
- Re: new function: textscan.m,
John W. Eaton <=
- Message not available
- Re: new function: textscan.m, Ben Abbott, 2010/10/23
- Re: new function: textscan.m, Liam Groener, 2010/10/23
- Re: new function: textscan.m, Ben Abbott, 2010/10/23