From: Rafael L. <lab...@mp...> - 2002-09-20 10:14:22
|
I do not now if there is already something similar to this in octave-forge, but the script attached below might be a good contribution. Sometimes, I need to now which files have been loaded by a given Octave script, like in cases I need to send teh script to someone else and it calls some functions not available to the recipient. The Perl script below do that. Better explaining with an exemple: $ cat testfun.m function x=testfun;x=0;endfunction $ cat testscript.m is_scalar(testfun) $ octave-which testscript.m /usr/share/octave/2.1.36/m/general/is_scalar.m /home/rafael/octave/testfun.m It also accepts input from stdin: $ octave-which < testscript.m /usr/share/octave/2.1.36/m/general/is_scalar.m /home/rafael/octave/testfun.m If another octave command is needed, use a second argument: $ octave-which testscript.m octave-2.0.17 /usr/share/octave/2.0.17/m/general/is_scalar.m /home/rafael/octave/testfun.m If stdin is desired along with an alternate octave command, use '-' as the script name: $ cat testscript.m | octave-which - octave-2.1.36 /usr/share/octave/2.1.36/m/general/is_scalar.m /home/rafael/octave/testfun.m At any rate: $ octave-which --help Usage: octave-which [script [octave-command] octave-which runs the Octave script specified as the first argument and print a list of paths for the user defined functions loaded in the script. If no argument is given, the Octave commands are read from stdin. An alternative Octave executable can be given as second argument. If stdin is wanted in this case, use '-' at the place of the script filename. Comments/enhacements are welcome. -- Rafael Laboissiere |