[Index for tmp_for_tar/misc]
[Return to Master Index]
leval
(tmp_for_tar/misc/leval.m)
Function Synopsis
[...] = leval (func,l)
Help text
[r1,..,rn] = leval (func,l) - Pass args to a function, return output
[r1,..,rn] = f (nth(l,1),...,nth(l,length(l)))
f : string : Name of function
l : list : Arguments that will be passed to f
Overhead seems to be ~3ms on a 350MHZ PII.
Last modified: April 2001
Cross-Reference Information
This function is called by
Listing of function file tmp_for_tar/misc/leval.m
## [r1,..,rn] = leval (func,l) - Pass args to a function, return output
##
## [r1,..,rn] = f (nth(l,1),...,nth(l,length(l)))
##
## f : string : Name of function
## l : list : Arguments that will be passed to f
##
## Overhead seems to be ~3ms on a 350MHZ PII.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: April 2001
function [...] = leval (func,l)
arg_str = res_str = ev2 = "";
if length(l),
# String to pass arguments
arg_str = sprintf ("nth(l,%i),",1:length(l));
arg_str = arg_str(1:length(arg_str)-1); # Remove last ","
end
# String to collect result
if nargout>1,
res_str = sprintf ("res%i,",1:nargout);
res_str = [ "[", res_str(1:length(res_str)-1), "]="];
elseif nargout==1,
res_str = "res1=";
end
# String to call function with args and
# collect results
ev1 = [res_str,func,"(",arg_str,");"];
# String to put results in vr_val
if nargout, ev2 = sprintf("vr_val (res%i);",1:nargout);
end
eval ([ev1,ev2]); # Single call to eval
Produced by oct2html on Sat Apr 28 21:14:54 2001
Cross-Directory links are: ON