[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Newly created scripts?
From: |
Mikhail Zotov |
Subject: |
Newly created scripts? |
Date: |
Wed, 24 Feb 2010 16:40:44 +0300 |
Hello everybody,
I am observing a strange behaviour of Octave-3.2.3 and 3.2.4 with
newly created files (i.e. those that do not exist at the moment a
script is started). Please, consider the following example:
# testrun.m
clear
delete("testfile*")
filename0 = "testfile";
for i=1:9,
filename = [filename0 int2str(i)];
diaryname = [filename0 int2str(i) ".m"];
opendiary = ["diary " diaryname];
if exist(filename,"file")==2,
delete(diaryname)
else
disp("Nothing to delete")
endif
disp([diaryname " does not exist"])
eval(opendiary)
disp(["i=" int2str(i)])
diary off
disp([diaryname " created"])
if exist(diaryname,"file")==2,
eval(filename)
disp([filename " evaluated"])
else
disp("oops"), break
endif
endfor
# EOF
When I run it for the first time, I get:
octave:1> testrun
error: no such file, `/path/to/testfile1.m'
error: called from:
error: /path/to/testrun.m at line 13, column 2
The next run:
octave:2> testrun
warning: delete: no such file: testfile*
Nothing to delete
testfile1.m does not exist
i=1
testfile1.m created
i = 1
testfile1 evaluated
Nothing to delete
testfile2.m does not exist
i=2
testfile2.m created
error: `testfile2' undefined near line 2 column 1
error: called from:
error: /path/to/testrun.m at line 26, column 3
Then run `in cycle' sometimes breaking at testfile3.m
If I comment `delete("testfile*")' at the beginning of the script and
make sure there are no testfile?.m in the Octave path, the situation
changes: on the first run, the script breaks at testfile2, on the
second run it breaks on testfile3, etc. Noticeably, `ls testfile*'
shows that the `missing' file actually exists (as does
`exist(...,"file")==2'!
I am sure all this worked in Octave releases prior to 3.2.x. Is this
a new feature? If so, what can I do to overcome it?
TIA,
Mikhail
- Newly created scripts?,
Mikhail Zotov <=