[scilab-Users] path
Serge Steer
serge.steer at inria.fr
Wed Oct 12 22:01:26 CEST 2011
----- Mail original -----
> De: "Ricardo Fabbri" <rfabbri at gmail.com>
> À: users at lists.scilab.org
> Envoyé: Mercredi 12 Octobre 2011 20:09:03
> Objet: [scilab-Users] path
> Hello, all,
>
> I have some simple questions, I knew their answer, but I wonder if
> things in recent scilab versions:
>
> - Is there anything like a search PATH setting? For instance, I would
> like to execute myscript.sce, but without specifying its full path. I
> would also like to load a function automatically if it is in the path,
> more or less matlab style.
>
for this point there is a solution based on an undocumented feature
if the %onprompt function is defined it is automatically called just after the main prompt is displayed.
Try
function %onprompt(),mprintf("hello\n"),endfunction
Using this function it is possible to implement a Matlab like mechanism (I have developped it, but the code is corrently located on my computer at work which is down due to a disk problem.
If you need it I can send it to you when my desktop problem will be fixed.
It is not very hard
Define a global variable PATHS that contains a string vector of paths
for each path, use lstfiles to get the sci files, using newest determines which requires to be reloaded, exec these one inside a try.
Using who("get") at the beginning and at the end of the process allows to know which are the refined functions. Finally a resume with the names of redefined functions as lhs and rhs finishes the job.
Note however this works for functions and not for scripts.
Serge
Serge
> - Aliases: is there a way to define an alias to a function? for
> example,
> alias ("doc", help)
>
> There is newfun/funptr combination to do this, but I wonder if
> something simple like the above, for all types of functions, are
> available.
>
The Samuel's answer is perfect.
> Thanks,
> Ricardo
> --
> Linux registered user #175401
> www.lems.brown.edu/~rfabbri
More information about the users
mailing list