|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
migrating from Matlab to Octave 20080513 - cdAs a new Octave user, I found the following issues (somewhat
trivial) in migrating my Matlab code to Octave. Thanks - DjK. Issue 1.) A
return value for ‘cd’ is not allowed in Octave as it is for Matlab,
and, 2.) The
required function (‘pwd’) is not cross-referenced in the help documentation
for ‘cd’. Explanation In MATLAB I used the ‘cd’ function
to return the pwd info. Octave does not allow this. Proposed Interim Solution Add ‘pwd’ to list of cross-referenced
keywords under “See also:” in all help documentation for the
functions: ‘cd’ ‘mkdir’ ‘rmdir’ ‘dir’
‘readdir’ ‘isdir’ ‘what’ ‘which’
‘exist’ and ‘ls’. Additionally, it’d be useful if
these functions all had the same cross-reference list in their respective help
file. Proposed Long-Term Solution Change ‘cd’ command to a function and
allow it to return the current directory info for compatibility with Matlab. For instance, before explicitly changing the working
directory, I’d record the current directory info so it could be restored
when I finished. Using the same command for all 3 lines makes the
code a little easier to learn (less to look up). CurrentDirectory = cd; cd(PROGRAM_PATH); … cd(CurrentDirectory);
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/f16-6011.html MATLAB Function Reference cd - Change working directory Syntax cd w = cd cd('directory') cd('..') cd directory Description cd displays the current working directory. w = cd assigns the current working directory to w. cd('directory') sets the current working directory to
directory. Use the full pathname for directory. On UNIX® platforms, the
character ~ is interpreted as the user's root directory. cd('..') changes the current working directory to the
directory above it. cd directory or cd .. is the unquoted form of the syntax. Examples On UNIX platforms, cd('/usr/local/matlab/toolbox/control/ctrldemos') changes the current working directory to ctrldemos for the
Control System Toolbox. On Windows® platforms, cd('c:/matlab/toolbox/control/ctrldemos') changes the current working directory to ctrldemos for the
Control System Toolbox. Then typing cd .. changes the current working directory to control, and typing cd .. again, changes the current working directory to toolbox. On any platform, use cd with the matlabroot function to
change to a directory relative to the directory in which MATLAB is installed.
For example cd([matlabroot '/toolbox/control/ctrldemos']) changes the current working directory to ctrldemos for the
Control System Toolbox. See Also dir, fileparts, mfilename, path, pwd, wha _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
| Free Forum Powered by Nabble | Forum Help |