<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<font face="Courier New">Dear All,<br>
<br>
I'm trying to cast an error message for a function<br>
<br>
The test and message are<br>
<br>
</font><font face="Courier New">if argn(2)<>1<br>
t1 = "%s: Wrong number of input arguments: %d expected.\n"</font><br>
<font face="Courier New"> t2 = "Si" </font><br>
<font face="Courier New"> error(msprintf(gettext(t1),t2,1));<br>
end<br>
<br>
The function has only one argument, so if invoked with 0 or more
than one argument, the message should be the same. With 0
arguments I get:<br>
<br>
<br>
--> y = Si()<br>
<br>
0.<br>
at line 26 of function Si ( D:\work_scilab\Si.sci line 26 )<br>
<br>
Si: Wrong number of input arguments: 1 expected.<br>
</font><font face="Courier New"><br>
<br>
This is the correct and expected message. However, with 2
arguments I get<br>
<br>
<br>
--> y = Si(1,2)<br>
<br>
Wrong number of input arguments.<br>
<br>
<br>
This error seems to have been trapped before my test, the
execution is halted and my message doesn't show. I've also tested
the function wavwrite, which requires 2 or 3 arguments. With 0 or
1 the message is the expected one, but with 4 or more arguments, I
get the same result as in my example.<br>
<br>
Seems as if less arguments are handled by the custom error
handler, but more than required is handled by sort of a parser. <br>
<br>
I think this behavior contradicts the facility of customizing
error messages.<br>
<br>
Regards,<br>
<br>
Federico Miyara <br>
<br>
</font>
</body>
</html>