From c8c6368cd58dbd17f75a76f6dd2399b7b3d7a71c Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 7 Aug 2009 08:41:10 +0000 Subject: improved FA_SZ_FROM_VAL to make it more generic --- macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'macros') diff --git a/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci b/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci index e9d88650..238bfc20 100644 --- a/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci +++ b/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci @@ -11,16 +11,27 @@ function opout = FA_SZ_FROM_VAL(in1) // // ----------------------------------------------------------------- -SCI2CNInArgCheck(argn(2),1,1); +SCI2CNInArgCheck(argn(2),1,1); -in1num = eval(in1) ; - -if ( in1num < 0 ) + +if (SCI2Cisnum(in1)) + in1num = eval(in1) ; + if isnan(in1num) + opout = '__SCI2CNANSIZE'; + elseif ( in1num < 0 ) opout= '0' ; -else + else opout = string ( floor (abs(in1num))) ; + + end + + +else + opout = in2+"0floor"+in2+"0"+"("+in1+")"; + opout = in2+"0abs"+in2+"0"+"("+opout+")"; + end -endfunction +endfunction -- cgit