Mon 21 Oct 2013 04:05:41 PM UTC, comment #11:
I committed your patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/9ccb48d39ce9). I also re-wrote the docstring to make it clearer and added some input validation tests. This will be part of the next Octave release due out in a few weeks. Thanks for helping make Octave better.
|
Sun 20 Oct 2013 08:48:11 PM UTC, comment #10:
Attached is a new patch. I tested its behavior with testrun.m (also attached).
I extended "run" to be able to run a script which is in the path (here scripta.m) without specifying its path :
This works in matlab, but in octave it currently only worked if the script was in the current directory.
(file #29430, file #29431)
|
Fri 18 Oct 2013 11:43:05 AM UTC, comment #9:
Yes, sounds good to me.
|
Fri 18 Oct 2013 11:34:32 AM UTC, comment #8:
See my comment #5. The rule could be "always try to run with .m extension first, when none was provided".
If you agree with this I can implement it if you like.
|
Fri 18 Oct 2013 05:35:06 AM UTC, comment #7:
This doesn't look like an area where we need 100% compatibility. I think we should preserve the ability to 'run' any file, but add the compatible behavior of adding a ".m" to the end of the file name if the user forgot it.
|
Fri 18 Oct 2013 01:46:15 AM UTC, comment #6:
I had someone check what run does on a "testscript" with different file extensions. If the files testscript, testscript.m, and testscript.txt all exist in the current directory, and each with a call to disp to show their own name:
So what it looks like is Matlab only supports run on .m files, adds the .m extension if it is missing, and refuses to run any non-.m files.
Octave currently supports run on any file, with or without an extension. So how far do we want to go with Matlab compatibility here?
|
Mon 30 Sep 2013 10:39:38 PM UTC, comment #5:
One more octave feature I hadn't noticed ...
I could check matlab does not support running files with no file extension (at leat using "run"). Thus, for matlab compatibility your example should run ~/myscript.m (and maybe warn the user that ~/myscript.m was run, and that he can use source to run the desired file)
If no directory is provided e.g.,
run myscript.m if it exists in the path else run myscript if it exists in the path
This preserves the ability to run files with no file extension in most of the cases without breaking ml compatibility.
|
Mon 30 Sep 2013 12:33:57 AM UTC, comment #4:
This patch breaks run on files with no file extension, if that is a desired behavior (I think it is).
If I do
If there is a file ~/myscript.m, it should be run. What if there is a file named ~/myscript? What if both files exist, which one should be preferred?
|
Mon 23 Sep 2013 03:18:20 AM UTC, comment #3:
Tested the patch on GNU Octave, version 3.7.6+ (from mercurial repository) under Fedora 17 and confirmed it fixes the missing ".m" extension error:
octave:1> run('~/test.m')
A =
1 1 1
1 1 1
1 1 1
1 1 1
octave:2> run('~/test')
A =
1 1 1
1 1 1
1 1 1
1 1 1
|
Mon 09 Sep 2013 09:32:40 PM UTC, comment #2:
Attached is a patch. The ".m" extension is added if none has been found.
(file #29092)
|
Thu 29 Aug 2013 01:44:58 PM UTC, comment #1:
This is a simple fix. Can you provide a patch?
|
Thu 29 Aug 2013 08:55:30 AM UTC, original submission:
This
run('~/sources/vlfeat/toolbox/vl_setup')
works in matlab, but not in octave. There, we need
run('~/sources/vlfeat/toolbox/vl_setup.m')
|