summaryrefslogtreecommitdiff
path: root/newstructure/macros/Checktype.sci
diff options
context:
space:
mode:
authorHarpreet2016-09-03 00:36:51 +0530
committerHarpreet2016-09-03 00:36:51 +0530
commita0d9443af147e949c1e6a01ac24749d12593ec5b (patch)
tree1a1955c5482ae608fd7f618b06f4ecc6a0d39a23 /newstructure/macros/Checktype.sci
parent4b64cf486f5c999fd8167758cae27839f3b50848 (diff)
downloadFOSSEE-Optim-toolbox-development-a0d9443af147e949c1e6a01ac24749d12593ec5b.tar.gz
FOSSEE-Optim-toolbox-development-a0d9443af147e949c1e6a01ac24749d12593ec5b.tar.bz2
FOSSEE-Optim-toolbox-development-a0d9443af147e949c1e6a01ac24749d12593ec5b.zip
cbcintlinprog added
Diffstat (limited to 'newstructure/macros/Checktype.sci')
-rw-r--r--newstructure/macros/Checktype.sci65
1 files changed, 0 insertions, 65 deletions
diff --git a/newstructure/macros/Checktype.sci b/newstructure/macros/Checktype.sci
deleted file mode 100644
index 3f50fa2..0000000
--- a/newstructure/macros/Checktype.sci
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2010 - DIGITEO - Michael Baudin
-//
-// This file must be used under the terms of the GNU LGPL license.
-
-function errmsg = Checktype ( funname , var , varname , ivar , expectedtype )
- // Generates an error if the given variable is not of expected type.
- //
- // Calling Sequence
- // errmsg = Checktype ( funname , var , varname , ivar , expectedtype )
- //
- // Parameters
- // funname : a 1 x 1 matrix of strings, the name of the calling function.
- // var : a 1 x 1 matrix of valid Scilab data type, the variable
- // varname : a 1 x 1 matrix of string, the name of the variable
- // ivar : a 1 x 1 matrix of floating point integers, the index of the input argument in the calling sequence
- // expectedtype : a n x 1 or 1 x n matrix of strings, the available types for the variable #ivar
- // errmsg : a 1 x 1 matrix of strings, the error message. If there was no error, the error message is the empty matrix.
- //
- // Description
- // This function is designed to be used to design functions with
- // input arguments with variable type.
- // We use the typeof function to compute the type of the variable:
- // see help typeof to get the list of all available values for expectedtype.
- // Last update : 29/07/2010.
- //
- // Examples
- // // The function takes a string argument.
- // function myfunction ( x )
- // Checktype ( "myfunction" , x , "x" , 1 , "string" )
- // disp("This is a string")
- // endfunction
- // // Calling sequences which work
- // myfunction ( "Scilab" )
- // // Calling sequences which generate an error
- // myfunction ( 123456 )
- //
- // // The function takes a string or a matrix of doubles argument.
- // function myfunction ( x )
- // Checktype ( "myfunction" , x , "x" , 1 , [ "string" "constant" ] )
- // if ( typeof(x) == "string" ) then
- // disp("This is a matrix of strings")
- // else
- // disp("This is a matrix of doubles")
- // end
- // endfunction
- // // Calling sequences which work
- // myfunction ( "Scilab" )
- // myfunction ( 123456 )
- // // Calling sequences which generate an error
- // myfunction ( uint8(2) )
- //
- // Authors
- // Michael Baudin - 2010 - DIGITEO
- //
-
- errmsg = []
- if ( and ( typeof ( var ) <> expectedtype ) ) then
- strexp = """" + strcat(expectedtype,""" or """) + """"
- errmsg = msprintf(gettext("%s: Expected type [%s] for input argument %s at input #%d, but got ""%s"" instead."),funname, strexp, varname , ivar , typeof(var) );
- error(errmsg);
- end
-endfunction
-
-
-