[Scilab-users] Custom function takes arguments from workspace
Stefan Du Rietz
sdr at durietz.se
Fri Apr 10 17:38:57 CEST 2015
Hello,
I also once had that problem.
But you can check if it is a local variable:
if exists("my_last_argument", "l") then
Regards
Stefan
On 2015-04-10 17:21, Pablo Fonovich wrote:
> Hi:
> I've noticed that if i make a function with for example 3 inputs
> arguments, and in the call i forget to give one input argument, the
> function uses (if it exist) a variable from the console with the same
> name of the missing argument. For example... i have this function:
>
> function y=circconv(x,h,N)
> x=x(:)';h=h(:)';
> hzp=zeros(1,N);xzp=zeros(1,N)
> if length(x)<N then
> xzp=[x zeros(1,N-length(x))]
> else
> xzp=x(1:N);
> end
> if length(h)<N then
> hzp=[h zeros(1,N-length(h))]
> else
> hzp=h(1:N);
> end
> y=ifft(fft(xzp).*fft(hzp))
> endfunction
>
> If i call the function without giving the argument N, but there is a
> variable called N in the workspace, it uses that N...
> Is this intentional? So, if i want the user to give exactly the 3
> arguments... the only solution would be using argn?
>
> because this was causing me some bugs
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
More information about the users
mailing list