diff options
author | yash1112 | 2017-07-07 21:20:49 +0530 |
---|---|---|
committer | yash1112 | 2017-07-07 21:20:49 +0530 |
commit | 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch) | |
tree | f50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/macros/GeneralFunctions | |
download | Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2 Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip |
sci2c arduino updated
Diffstat (limited to '2.3-1/macros/GeneralFunctions')
31 files changed, 1215 insertions, 0 deletions
diff --git a/2.3-1/macros/GeneralFunctions/Array2String.sci b/2.3-1/macros/GeneralFunctions/Array2String.sci new file mode 100644 index 00000000..27e9aa15 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/Array2String.sci @@ -0,0 +1,40 @@ +function [StringArray] = Array2String(InArray);
+// function [StringArray] = Array2String(InArray);
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Converts an input array into a string. Maximum 2D array are allowed.
+// Ex.: InArray = [10, 4];
+// StringArray = "[10, 4]";
+// #RNU_RES_E
+//
+// Input data:
+// InArray: Input array.
+//
+// Output data:
+// StringArray: array converted into a string.
+//
+// Status:
+// 13-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+[Nrows,Ncols] = size(InArray);
+
+StringArray = '[';
+for counterrows = 1:Nrows
+ for countercols = 1:Ncols
+ StringArray = StringArray + string(InArray(counterrows,countercols)) + ',';
+ end
+ StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ','
+ StringArray = StringArray+';';
+end
+StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ';'
+StringArray = StringArray+']';
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/ConvertPathMat2C.sci b/2.3-1/macros/GeneralFunctions/ConvertPathMat2C.sci new file mode 100644 index 00000000..d73d22c7 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/ConvertPathMat2C.sci @@ -0,0 +1,61 @@ +function OutPath = ConvertPathMat2C(InPath,CPathStyle)
+// function OutPath = ConvertPathMat2C(InPath,CPathStyle)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Converts the input path InPath into a path by using the path
+// style specified by CPathStyle.
+// #RNU_RES_E
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 26-Jan-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+if (CPathStyle == 'windows')
+ OutPath=strsubst(InPath,'/','\');
+elseif (CPathStyle == 'unix')
+ OutPath=strsubst(InPath,'\','/');
+elseif (CPathStyle == 'cygwin')
+ OutPath=strsubst(InPath,'\','/');
+ OutPath=strsubst(OutPath,'A:','/cygdrive/a');
+ OutPath=strsubst(OutPath,'B:','/cygdrive/b');
+ OutPath=strsubst(OutPath,'C:','/cygdrive/c');
+ OutPath=strsubst(OutPath,'D:','/cygdrive/d');
+ OutPath=strsubst(OutPath,'E:','/cygdrive/e');
+ OutPath=strsubst(OutPath,'F:','/cygdrive/f');
+ OutPath=strsubst(OutPath,'G:','/cygdrive/g');
+ OutPath=strsubst(OutPath,'H:','/cygdrive/h');
+ OutPath=strsubst(OutPath,'I:','/cygdrive/i');
+ OutPath=strsubst(OutPath,'J:','/cygdrive/j');
+ OutPath=strsubst(OutPath,'K:','/cygdrive/k');
+ OutPath=strsubst(OutPath,'L:','/cygdrive/l');
+ OutPath=strsubst(OutPath,'M:','/cygdrive/m');
+ OutPath=strsubst(OutPath,'N:','/cygdrive/n');
+ OutPath=strsubst(OutPath,'O:','/cygdrive/o');
+ OutPath=strsubst(OutPath,'P:','/cygdrive/p');
+ OutPath=strsubst(OutPath,'Q:','/cygdrive/q');
+ OutPath=strsubst(OutPath,'R:','/cygdrive/r');
+ OutPath=strsubst(OutPath,'S:','/cygdrive/s');
+ OutPath=strsubst(OutPath,'T:','/cygdrive/t');
+ OutPath=strsubst(OutPath,'U:','/cygdrive/u');
+ OutPath=strsubst(OutPath,'V:','/cygdrive/v');
+ OutPath=strsubst(OutPath,'W:','/cygdrive/w');
+ OutPath=strsubst(OutPath,'X:','/cygdrive/x');
+ OutPath=strsubst(OutPath,'Y:','/cygdrive/y');
+ OutPath=strsubst(OutPath,'Z:','/cygdrive/z');
+else
+ OutPath = InPath;
+end
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/File2StringArray.sci b/2.3-1/macros/GeneralFunctions/File2StringArray.sci new file mode 100644 index 00000000..626cb6ce --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/File2StringArray.sci @@ -0,0 +1,54 @@ +function [String_Array,N_Strings] = File2StringArray(InFileName)
+// function [String_Array,N_Strings] = File2StringArray(InFileName)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Reads a text file and stores every line into a string array.
+// #RNU_RES_E
+//
+// Input data:
+// InFileName: path+filename of the input file.
+//
+// Output data:
+// String_Array: array of strings containing the lines of the input
+// text file.
+// N_Strings: number of strings stored in String_Array.
+//
+// Status:
+// 10-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+N_Strings = 0;
+String_Array = '';
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+// --------------------
+// --- Open C file. ---
+// --------------------
+fidfile = SCI2COpenFileRead(InFileName);
+
+// -------------------
+// --- Read lines. ---
+// -------------------
+tmpline = mgetl(fidfile,1);
+while (meof(fidfile) == 0)
+ N_Strings = N_Strings + 1;
+ String_Array(N_Strings) = tmpline;
+ tmpline = mgetl(fidfile,1);
+end
+
+mclose(fidfile);
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/FunName2SciFileName.sci b/2.3-1/macros/GeneralFunctions/FunName2SciFileName.sci new file mode 100644 index 00000000..39ff5b21 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/FunName2SciFileName.sci @@ -0,0 +1,56 @@ +function ScilabFileName = FunName2SciFileName(DirList,InFunName);
+// function ScilabFileName = FunName2SciFileName(DirList,InFunName);
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// This function generates the full path of the scilab file
+// related to the function name (InFunName) specified.
+// In more detail the file "eval(InFunName).sci" file is searched
+// in the directories specified in DirList.
+// #RNU_RES_E
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+if (prod(size(DirList)) == 0)
+ error(9999, 'Incorrect DirList parameter.');
+end
+
+if (prod(size(InFunName)) == 0)
+ error(9999, 'Incorrect InFunName parameter.');
+end
+
+// --- Generate the PathList. ---
+for tmpcounter = 1:max(size(DirList))
+ PathList(tmpcounter) = fullfile(DirList(tmpcounter),(InFunName+'.sci'));
+end
+
+// --- Search the .sci file. ---
+ScilabFileName = listfiles(PathList);
+
+// --- Check on the number of .sci files found. ---
+if ((prod(size(ScilabFileName))) > 1)
+ disp(ScilabFileName);
+ error(9999, 'Found more than one scilab file.');
+end
+
+if ((prod(size(ScilabFileName))) < 1)
+ disp(ScilabFileName);
+ error(9999, 'Scilab file ""'+InFunName+'.sci"", not found');
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/IsNanSize.sci b/2.3-1/macros/GeneralFunctions/IsNanSize.sci new file mode 100644 index 00000000..486f6fcc --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/IsNanSize.sci @@ -0,0 +1,39 @@ +function outbool = IsNanSize(instring)
+// function outbool = IsNanSize(instring)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// It searches for __SCI2CNANSIZE string in the string which specifies the
+// size of the argument. Useful to find if a given size contains
+// a nan value. In this case an error is issued.
+// IsNanSize = '__SCI2CNANSIZE' -> True
+// IsNanSize = 'c*__SCI2CNANSIZE' -> True
+// IsNanSize = 'c+b' -> False
+// #RNU_RES_E
+//
+// Input data:
+// instring: string to analyze.
+//
+// Output data:
+// outbool: %T if nan string has been found.
+//
+// Status:
+// 11-Feb-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+outbool = %F;
+indexval = strindex(instring,'__SCI2CNANSIZE');
+
+if(length(indexval)>=1)
+ outbool = %T;
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/KeyStr2FileStrPos.sci b/2.3-1/macros/GeneralFunctions/KeyStr2FileStrPos.sci new file mode 100644 index 00000000..e9fb1c48 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/KeyStr2FileStrPos.sci @@ -0,0 +1,83 @@ +function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method)
+// function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method)
+// --------------------------------------------------------------------------------
+// #RNU_RES_B
+// This function returns a line and its position from a specified ASCII file.
+// The line and the position returned starts with a key string specified in the
+// input parameters.
+//
+// Input data:
+// filename: path + name of the ASCII file.
+// key_string: string that specifies the initial portion of the line to return.
+// method: 'cut': in the returned line will be removed the key_string
+// 'no_cut': (default), in the returned line will not be removed the key_string
+//
+// Output data:
+// flag_found: 0 if the line is not found or an error occured.
+// 1 if the search succeed.
+// requested_line: is the line in the file which contains as first characters those
+// specified in the key_string.
+// line_position: position of the line in the file; the first line in the file
+// is the line number 1.
+// #RNU_RES_E
+//
+//
+// Status:
+// 08-Jul-2002 -- Author: Raffaele Nutricato
+// 08-Jul-2002 -- Raffaele Nutricato: Revision OK
+// 23-Nov-2004 -- Raffaele Nutricato: Changed disp to warning in if (flag_found == 0).
+// It allows to disable the message it generates
+// by using warning off.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,3);
+
+
+if (argn(2) == 2)
+ method = 'no_cut';
+end
+method = convstr(method, 'u');
+
+// Initialize output parameters
+flag_found = 0;
+requested_line = '';
+line_position = 0;
+
+// Open the text file (read only)
+[fid,mess] = mopen(filename,'r');
+if ( fid == -1 )
+ disp(['Cannot open: '+filename])
+ disp(mess);
+ flag_found = 0;
+ return;
+end
+
+// loop on the lines of the file
+num_chars = length(key_string);
+while (meof(fid) == 0)
+ check_string = fgetl(fid);
+ line_position = line_position + 1;
+ if (key_string == check_string) & (key_string == num_chars) then
+ flag_found = 1;
+ requested_line = check_string;
+ if (method =='cut') then
+ requested_line(1:num_chars) = [];
+ end
+ mclose(fid);
+ return;
+ end
+end
+
+if (flag_found == 0)
+ warning('Warning: string ' + key_string + ' not found in file: ' + filename);
+ mclose(fid);
+end
+
+mclose(fid);
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/PrintStepInfo.sci b/2.3-1/macros/GeneralFunctions/PrintStepInfo.sci new file mode 100644 index 00000000..8e1c1d02 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/PrintStepInfo.sci @@ -0,0 +1,56 @@ +function PrintStepInfo(inputstring,filename,outputtype,formattedstring) +// function PrintStepInfo(inputstring,filename,outputtype,formattedstring) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Prints a string by using a predefined format into a file or on +// the stdout. +// +// Input data: +// filename: optional parameter, that specifies the output file. +// If filename is '' or it is not provided to the function, +// the string will be printed on the stdout. +// outputtype: 'file' -> prints only on file. +// 'stdout' -> prints only on the stdout. +// 'both' -> prints on both file and stdoud. +// Default is 'stdout'. +// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr). +// if 'y' then str is considered formatted according to mfprint syntax +// Output data: +// +// #RNU_RES_E +// Status: +// 02-Jan-2006 -- Nutricato Raffaele: Author. +// 02-Jan-2006 -- Nutricato Raffaele: TEST OK. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,4); + +if argn(2) < 4 + formattedstring = 'n'; + if argn(2) < 3 + bothout = 'n'; + if argn(2) < 2 + filename = ''; + end + end +end +if (length(filename) == 0) + outputtype = 'stdout'; // Prints only on the stdout. +end + +blankstring = [' ']; + +if ((outputtype=='both') | (outputtype=='stdout')) + disp(blankstring+'==> '+inputstring); +end + +if ((outputtype=='both') | (outputtype=='file')) + filenamefprintf(filename,'y',blankstring+'==> '+inputstring,formattedstring); +end +endfunction diff --git a/2.3-1/macros/GeneralFunctions/PrintStringInfo.sci b/2.3-1/macros/GeneralFunctions/PrintStringInfo.sci new file mode 100644 index 00000000..a554d122 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/PrintStringInfo.sci @@ -0,0 +1,69 @@ +function PrintStringInfo(str, filename, outputtype, ennewline,formattedstring)
+// function PrintStringInfo(str,filename,outputtype,ennewline,formattedstring)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Prints a string into a file or on the stdout or on both.
+//
+// Input data:
+// filename: optional parameter, that specifies the output file.
+// If filename is '' or it is not provided to the function,
+// the string will be printed on the stdout.
+// outputtype: 'file' -> prints only on file.
+// 'stdout' -> prints only on the stdout.
+// 'both' -> prints on both file and stdout.
+// Default is 'stdout'.
+// ennewline: optional (default = 'y'); If y adds a newline character
+// at the end of the input string.
+// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr).
+// if 'y' then str is considered formatted according to mfprint syntax
+//
+// Output data:
+// ---
+// #RNU_RES_E
+//
+// Status:
+// 02-Jan-2006 -- Nutricato Raffaele: Author.
+// 02-Jan-2006 -- Nutricato Raffaele: TEST OK.
+// 02-May-2006 -- Nutricato Raffaele: Added ennewline.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),0,5);
+
+if argn(2) < 5
+ formattedstring = 'n';
+ if argn(2) < 4
+ ennewline = 'y';
+ if argn(2) < 3
+ outputtype = 'stdout';
+ if argn(2) < 2
+ filename = '';
+ if argn(2) < 1
+ str = '';
+ end
+ end
+ end
+ end
+end
+if (length(filename) == 0) then
+ outputtype = 'stdout'; // Prints only on the stdout.
+end
+
+if (outputtype=='both') | (outputtype=='stdout')
+ disp(str)
+end
+
+if (outputtype=='both') | (outputtype=='file')
+ if (ennewline=='y')
+ filenamefprintf(filename,'y',str,formattedstring);
+ else
+ filenamefprintf(filename,'n',str,formattedstring);
+ end
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/ReadStringCard.sci b/2.3-1/macros/GeneralFunctions/ReadStringCard.sci new file mode 100644 index 00000000..a4525d90 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/ReadStringCard.sci @@ -0,0 +1,61 @@ +function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror)
+// function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Reads the string associated to the card cardname placed
+// in filename.
+// The value of cardname is assumed to be a string.
+// If the card is not found an error will occur.
+//
+// Input data:
+// filename: full path + name of the file where the card
+// is being searched.
+// cardname: string with the name of the card.
+// commentdelim: specifies a character for an eventual comment
+// (to be discarded) after the card value.
+// enableerror: 'y' enable error message.
+// 'n' enable warning message.
+//
+// Output data:
+// cardvalue: string associated to the card. Blanks characters
+// are discarded.
+// #RNU_RES_E
+//
+// Status:
+// 06-Feb-2004 -- Nutricato Raffaele: Author.
+// 06-Feb-2004 -- Nutricato Raffaele: TEST OK.
+// 25-Jun-2004 -- Nutricato Raffaele: Added Comment delimiter
+// and enableerror as input parameter.
+// 13-Apr-2007 -- Intelligente Fabio: Rewritten from Matlab to Scilab.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,3);
+
+if argn(2) == 2 then
+ commentdelim = ' ';
+ enableerror = 'y';
+
+elseif argn(2) == 3 then
+ enableerror = 'y';
+end
+
+[flag_found,requested_line,dummy2] = ...
+ KeyString2FileStringPos(filename,cardname,'cut');
+cardvalue = stripblanks(strtok(requested_line,commentdelim));
+clear requested_line dummy2
+
+if (flag_found == 0) then
+ if (enableerror == 'y') then
+ error(9999, cardname+' not found');
+ else
+ warning([cardname,' not found']);
+ end
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2CCreateDir.sci b/2.3-1/macros/GeneralFunctions/SCI2CCreateDir.sci new file mode 100644 index 00000000..dcc39c3e --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2CCreateDir.sci @@ -0,0 +1,31 @@ +function SCI2CCreateDir(OutDir)
+// function SCI2CCreateDir(OutDir)
+// -----------------------------------------------------------------
+// Create the dir OutDir.
+//
+// Input data:
+// OutDir: full path (absolute or relative) of the directory to be created.
+//
+// Output data:
+// ---
+//
+// Status:
+// 25-Jun-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+[tmppath,tmpfname,tmpextension]=fileparts(OutDir) ;
+
+status_dir = mkdir(tmppath,tmpfname+tmpextension) ;
+if (status_dir == 0)
+ error(9999, 'Cannot create: '+OutDir);
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2CFindFile.sci b/2.3-1/macros/GeneralFunctions/SCI2CFindFile.sci new file mode 100644 index 00000000..912a72a8 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2CFindFile.sci @@ -0,0 +1,41 @@ +function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName)
+// function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName)
+// -----------------------------------------------------------------
+// //NUT: add description here
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 11-Jul-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+FlagFound = 0;
+SCIFileName = '';
+
+// Perform the search in the user .sci files.
+Nscipaths = size(PathList,1);
+counterscipaths = 1;
+while ((FlagFound == 0) & (counterscipaths <= Nscipaths))
+ dirscifilename = PathList(counterscipaths);
+ fullpathscifilename = fullfile(dirscifilename,FileName);
+ if (SCI2Cfileexist(dirscifilename,FileName))
+ // It is a function of the USER2C library.
+ FlagFound = 1;
+ SCIFileName = fullpathscifilename;
+ end
+ counterscipaths = counterscipaths + 1;
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2CNInArgCheck.sci b/2.3-1/macros/GeneralFunctions/SCI2CNInArgCheck.sci new file mode 100644 index 00000000..71b93328 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2CNInArgCheck.sci @@ -0,0 +1,26 @@ +function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs)
+// function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Check that NInArgs is in the range specified by MinNArgs and
+// MaxNArgs.
+//
+// Input data:
+// NInArgs: number of input arguments of the function under test.
+// MinNArgs: minimum number of input arguments allowed.
+// MaxNArgs: maximum number of input arguments allowed.
+//
+// Output data:
+// ---
+// #RNU_RES_E
+//
+// Status:
+// 23-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato
+// -----------------------------------------------------------------
+
+if ((NInArgs < MinNArgs) | (NInArgs > MaxNArgs))
+ error(9999, 'Incorrect number of input arguments.');
+end
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2COpenFileRead.sci b/2.3-1/macros/GeneralFunctions/SCI2COpenFileRead.sci new file mode 100644 index 00000000..8e54738c --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2COpenFileRead.sci @@ -0,0 +1,30 @@ +function fidnumber = SCI2COpenFileRead(filename)
+// function fidnumber = SCI2COpenFileRead(filename)
+// --------------------------------------------------------------------------------
+// Open a file in read mode.
+//
+// Input data:
+// filename: path + name of the file to read.
+//
+// Output data:
+// fidnumber: file identifier.
+//
+// Status:
+// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+// --- Open the .sci file (read only). ---
+[fidnumber,fiderror] = mopen(filename,'r');
+if (fiderror < 0)
+ error(['Cannot open (in read mode): '+filename]);
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2COpenFileWrite.sci b/2.3-1/macros/GeneralFunctions/SCI2COpenFileWrite.sci new file mode 100644 index 00000000..f87aef87 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2COpenFileWrite.sci @@ -0,0 +1,30 @@ +function fidnumber = SCI2COpenFileWrite(filename)
+// function fidnumber = SCI2COpenFileWrite(filename)
+// --------------------------------------------------------------------------------
+// Open a file in write mode.
+//
+// Input data:
+// filename: path + name of the file to be written.
+//
+// Output data:
+// fidnumber: file identifier.
+//
+// Status:
+// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+// --- Open the .sci file (write mode). ---
+[fidnumber,fiderror] = mopen(filename,'w');
+if (fiderror < 0)
+ error(9999, 'Cannot open (in write mode): '+filename);
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2CTemplate.sci b/2.3-1/macros/GeneralFunctions/SCI2CTemplate.sci new file mode 100644 index 00000000..e47bdd00 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2CTemplate.sci @@ -0,0 +1,32 @@ +function out = SCI2CTemplate(in1,in2)
+// function out = SCI2CTemplate(in1,in2)
+// -----------------------------------------------------------------
+// This is a template function which shows how to comment functions.
+//
+// Input data:
+// in1: input argument number 1
+// in2: input argument number 2
+//
+// Output data:
+// out: output argument number 1
+//
+// Status:
+// 03-Jan-2008 -- Raffaele Nutricato: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Ccopyfile.sci b/2.3-1/macros/GeneralFunctions/SCI2Ccopyfile.sci new file mode 100644 index 00000000..f95c29ef --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Ccopyfile.sci @@ -0,0 +1,49 @@ +function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
+// function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Copy the contents of infile into outfile. Append mode is used.
+//
+// Input data:
+// InFileName: path+filename of the input file.
+// OutFileName: path+filename of the input file.
+// CopyMode: 'append' or 'overwrite'
+// #RNU_RES_E
+//
+// Output data:
+// ---
+//
+// Status:
+// 23-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),3,3);
+
+if (CopyMode == 'append')
+ // ------------------------
+ // --- Open Input file. ---
+ // ------------------------
+ fidIn = SCI2COpenFileRead(InFileName);
+
+ // -------------------
+ // --- Read lines. ---
+ // -------------------
+ tmpline = mgetl(fidIn,1);
+ while (meof(fidIn) == 0)
+ PrintStringInfo(tmpline, OutFileName, 'file', 'y');
+ tmpline = mgetl(fidIn,1);
+ end
+ mclose(fidIn);
+elseif (CopyMode == 'overwrite')
+ PrintStringInfo(' ', OutFileName, 'file', 'y'); // Cannot use scilab copyfile when the directory is empty!.
+ copyfile(InFileName,OutFileName);
+else
+ SCI2Cerror('Unknown CopyMode: ""'+CopyMode+'""');
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cfileexist.sci b/2.3-1/macros/GeneralFunctions/SCI2Cfileexist.sci new file mode 100644 index 00000000..05dbf590 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cfileexist.sci @@ -0,0 +1,38 @@ +function ExistTest = SCI2Cfileexist(InDir,FileName)
+// function ExistTest = SCI2Cfileexist(InDir,FileName)
+// -----------------------------------------------------------------
+// Searches for the file FileName in the directory InDir.
+// Return %F if it doesn't exist.
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 12-Jun-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+tmppwd = pwd();
+cd(InDir);
+allfiles = ls(FileName);
+cd(tmppwd);
+
+if (size(allfiles,1) == 0)
+ ExistTest = %F;
+elseif (size(allfiles,1) == 1)
+ ExistTest = %T;
+else
+ SCI2Cerror('Very Strange! Found more than one file with the same name.');
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cflipud.sci b/2.3-1/macros/GeneralFunctions/SCI2Cflipud.sci new file mode 100644 index 00000000..2e988c1b --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cflipud.sci @@ -0,0 +1,40 @@ +function OutputData = SCI2Cflipud(InputData)
+// function OutputData = SCI2Cflipud(InputData)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Inverts (flips) the position of the arguments of InputData.
+// Input data can be a struct or an array.
+// Ex.:
+// A(1) = 'one';
+// A(2) = 'two';
+// A(3) = 'three';
+// B = SCI2Cflipud(A);
+// B(1) = 'three';
+// B(2) = 'two';
+// B(3) = 'one';
+//
+// Input data:
+// InputData: input array or structure.
+//
+// Output data:
+// OutputData: flipped version of the input array.
+//
+// #RNU_RES_E
+// Status:
+// 12-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+NInputs = size(InputData,1);
+OutputData = InputData; // To be sure that they will have the same structure.
+for cnt = 1:NInputs
+ OutputData(cnt) = InputData(NInputs-cnt+1);
+end
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cmdelete.sci b/2.3-1/macros/GeneralFunctions/SCI2Cmdelete.sci new file mode 100644 index 00000000..d19233dc --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cmdelete.sci @@ -0,0 +1,33 @@ +function SCI2Cmdelete(InFile)
+// function SCI2Cmdelete(InFile)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Deletes the input files only if the file really exists.
+// This avoids the issuing of the error generated by mdelete.
+//
+// Input data:
+// InFile: full path of the file to be deleted.
+//
+// Output data:
+// #RNU_RES_E
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+[Inx,Inierr]=fileinfo(InFile);
+if Inierr == 0
+ mdelete(InFile);//NUT: questa stampa a video il file che sta cancellando.
+ //NUT ho fatto delle altre prove e mi funzionava tutto. solo che quando
+ //NUT eseguo il codice scilab to c mi stampa a video tutto il nome del file.
+end
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cresize.sci b/2.3-1/macros/GeneralFunctions/SCI2Cresize.sci new file mode 100644 index 00000000..ba78fde0 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cresize.sci @@ -0,0 +1,33 @@ +function out = SCI2Cresize(in)
+// function out = SCI2Cresize(in)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// It is a dummy function used by the programmer to specify at a given
+// point that a variable is changing its size. This will be translated
+// into C code by re-assigning the size array.
+// Next releases of this function will include check to avoid
+// increment of the size outside the limits specified by the first
+// initialization of the variable.
+//
+// Input data:
+// in: input variable to be resized
+//
+// Output data:
+// out: resized variable
+//
+// #RNU_RES_E
+// Status:
+// 10-Jun-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+out = in;
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cstring.sci b/2.3-1/macros/GeneralFunctions/SCI2Cstring.sci new file mode 100644 index 00000000..cf6d4370 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cstring.sci @@ -0,0 +1,34 @@ +function outstring = SCI2Cstring(innum)
+// function outstring = SCI2Cstring(innum)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// It fixes the bug of string function when applied to
+// exponential formats:
+// Example:
+// -->string(10e-10)
+// ans =
+// 1.000D-09
+// Note how the "D" is syntactically wrong.
+//
+// Input data:
+// innnum: input number to be converted into string.
+//
+// Output data:
+// outstring: string containing the conversion.
+// #RNU_RES_E
+//
+// Status:
+// 07-May-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+outstring=strsubst(string(innum),'D','e');
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cstrncmp.sci b/2.3-1/macros/GeneralFunctions/SCI2Cstrncmp.sci new file mode 100644 index 00000000..54a5e148 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cstrncmp.sci @@ -0,0 +1,27 @@ +function res = SCI2Cstrncmp(s1,s2,n)
+// function res = SCI2Cstrncmp(s1,s2,n)
+// -----------------------------------------------------------------
+// This function compares first n characters of strings s1 and s2.
+// SCI2Cstrncmp(s1,s2,n) returns 1logical T (true) if the first n characters of
+// the strings s1 and s2 are the same and logical 0 (false) otherwise.
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),3,3);
+
+res = (part(s1,1:n) == part(s2,1:n));
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SCI2Cstrncmps1size.sci b/2.3-1/macros/GeneralFunctions/SCI2Cstrncmps1size.sci new file mode 100644 index 00000000..38e8c371 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SCI2Cstrncmps1size.sci @@ -0,0 +1,32 @@ +function res = SCI2Cstrncmps1size(s1,s2);
+// function res = SCI2Cstrncmps1size(s1,s2);
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// This function compares first n characters of strings s1 and s2.
+// n is the size of the string s1.
+// SCI2Cstrncmps1size returns logical T (true) if the first n characters of
+// the strings s1 and s2 are the same and logical 0 (false) otherwise.
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// #RNU_RES_E
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+n = length(s1);
+res = (part(s1,1:n) == part(s2,1:n));
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/SizeInByte.sci b/2.3-1/macros/GeneralFunctions/SizeInByte.sci new file mode 100644 index 00000000..fa2d4f94 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/SizeInByte.sci @@ -0,0 +1,41 @@ +function SizeIn = SizeInByte(InDataType)
+// function SizeIn = SizeInByte(InDataType)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Returns the size in bytes of the input data type.
+//
+// Input data:
+// InDataType: input data type. It can be:
+// 'float'
+// 'double'
+// 'floatComplex*'
+// 'doubleComplex*'
+//
+// Output data:
+// SizeIn: size in bytes of the input data type.
+//
+// #RNU_RES_E
+// Status:
+// 12-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+if (InDataType == 'float')
+ SizeIn = 4;
+elseif (InDataType == 'double')
+ SizeIn = 8;
+elseif (InDataType == 'floatComplex*')
+ SizeIn = 8;
+elseif (InDataType == 'doubleComplex*')
+ SizeIn = 16;
+else
+ error('Unknown data type: '+InDataType);
+end
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/buildmacros.sce b/2.3-1/macros/GeneralFunctions/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/GeneralFunctions/dispina.sci b/2.3-1/macros/GeneralFunctions/dispina.sci new file mode 100644 index 00000000..dc07cddc --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/dispina.sci @@ -0,0 +1,31 @@ +function dispina(instring);
+// function dispina(instring);
+// -----------------------------------------------------------------
+// Quista sacciu sulu iou comu funziona e a ce me serve.
+//
+// Input data:
+//
+// Output data:
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp(instring);
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/filenamefprintf.sci b/2.3-1/macros/GeneralFunctions/filenamefprintf.sci new file mode 100644 index 00000000..f25e603e --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/filenamefprintf.sci @@ -0,0 +1,48 @@ +function filenamefprintf(filename,ennewline,str,formattedstring)
+// function filenamefprintf(filename,ennewline,str,formattedstring)
+// --------------------------------------------------------------------------------
+// Uses the printf to print the string specified by varargin. filenamefprintf
+// uses the filename instead of the fid parameter used by fprintf.
+// Everytime filenamefprintf is called it
+// opens the file, prints the string in it and then closes it.
+// Opening is performed in read/append mode (at+).
+//
+// Input data:
+// filename: string that specifies the name of the file.
+// varargin are the input arguments for the printf.
+// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr).
+// if 'y' then str is considered formatted according to mfprint syntax
+//
+// Output data:
+// ---
+//
+// Status:
+// 31-Jan-2006 -- Nutricato Raffaele: Author.
+// 31-Jan-2006 -- Nutricato Raffaele: TEST OK.
+//
+// Copyright 2006 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),4,4);
+
+
+// [FidReportFile, mess] = mopen(deblank(filename),'at+');
+ [FidReportFile, mess] = mopen(filename,'a+');
+ if (FidReportFile == -1) then
+ error(9999, mess);
+ end
+ if formattedstring == 'n'
+ mputstr(str,FidReportFile);
+ else
+ mfprintf(FidReportFile, str);
+ end
+ if ennewline=='y' then
+ mfprintf(FidReportFile,'\n');
+ end
+ mclose(FidReportFile);
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/float.sci b/2.3-1/macros/GeneralFunctions/float.sci new file mode 100644 index 00000000..634950b1 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/float.sci @@ -0,0 +1,26 @@ +function y = float(x)
+// -----------------------------------------------------------------
+// Dummy function for float precision specifier.
+//
+// Input data:
+// x: input array or scalar.
+//
+// Output data:
+// y: output array or scalar.
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+ +// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+y = x;
+
+endfunction
diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib Binary files differnew file mode 100644 index 00000000..9d57416d --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/lib diff --git a/2.3-1/macros/GeneralFunctions/names b/2.3-1/macros/GeneralFunctions/names new file mode 100644 index 00000000..eb8300a1 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/names @@ -0,0 +1,28 @@ +Array2String +ConvertPathMat2C +File2StringArray +FunName2SciFileName +IsNanSize +KeyStr2FileStrPos +PrintStepInfo +PrintStringInfo +ReadStringCard +SCI2CCreateDir +SCI2CFindFile +SCI2CNInArgCheck +SCI2COpenFileRead +SCI2COpenFileWrite +SCI2CTemplate +SCI2Ccopyfile +SCI2Cfileexist +SCI2Cflipud +SCI2Cmdelete +SCI2Cresize +SCI2Cstring +SCI2Cstrncmp +SCI2Cstrncmps1size +SizeInByte +dispina +filenamefprintf +float +squeezestrings diff --git a/2.3-1/macros/GeneralFunctions/squeezestrings.sci b/2.3-1/macros/GeneralFunctions/squeezestrings.sci new file mode 100644 index 00000000..049476d1 --- /dev/null +++ b/2.3-1/macros/GeneralFunctions/squeezestrings.sci @@ -0,0 +1,31 @@ +function OutString = squeezestrings(InStringArray)
+// function OutString = squeezestrings(InStringArray)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Converts an array of strings into a single string.
+//
+// Input data:
+// InStringArray: Array of strings.
+//
+// Output data:
+// OutString: Output string.
+//
+// #RNU_RES_E
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+OutString = [];
+for counterstrings = 1:max(size(InStringArray))
+ OutString = OutString+InStringArray(counterstrings);
+end
+
+endfunction
|