------------------------------------------------------------------------------------------------------ ----------------------- Information and notes about file 'KlebeW1.ipf' --------------------------- ------------------------------------------------------------------------------------------------------ File created on 2016-07-20 by David Walter; for changes see [RR-hice] at the end of this file; last modified on 2019-11-20 09:20 UTC. File encoding: utf8; line ending: CRLF; recommended tab width: 8 characters The functions shall help to deal with the concatenation of waves and string lists. _______________________________________________________________________________________________________________________ -------------------------------------------------------------------------------------------- +++ Table of content of this file ##toc, -------------------------------------------------------------------------------------------- Shortcut . Content -------- . --------------------------- toc . + Table of content of this file gno . + General notes aiv . + About the individual functions F_KlebeFolderW1 . + F_KlebeFolderW1: Concatenate the waves of different folders F_StLaddps1 . + F_StLaddps1: Adding prefix and suffix to each element of a string list hice . + History of changes -------------------------------------------------------------------------------------------- +++ General notes ##gno, -------------------------------------------------------------------------------------------- This file contains explanations and examples for usage of the functions in file 'KlebeW1.ipf'. If you create a copy of it in folder 'C:\baustelle' on your hard drive, you can include it to your Igor project by adding the following as a line into the Procedure window: >> #include "C:baustelle:KlebeW1" As of 2019-11-20, all functions in the procedure file are static. Therefore the module name "Tao_KlebeW1" has to be written when invoking a function, which means that "Tao_KlebeW1#" has to be prepended before the function name. This shall avoid naming conflicts. -------------------------------------------------------------------------------------------- +++ About the individual functions ##aiv, -------------------------------------------------------------------------------------------- ------------------------------------------------------------------- ++ F_KlebeFolderW1: Concatenate the waves of different folders ##F_KlebeFolderW1, ------------------------------------------------------------------- Arguments of >> Static Function F_KlebeFolderW1( VrFrIn, VrFrOut, [VrWaves,VrAppend] ) - String VrFrIn // StringList of input folders, e.g. "root:FrBsp1;root:FrBsp2;root:FrBsp3;" - String VrFrOut // String containing the output folder, e.g. "root:FrBspCombined" - String VrWaves // StringList with the names of the Waves to be taken. If omitted, all waves of the first folder given by 'VrFrIn' are taken. - optional Variable VrAppend // Choose 1 for appending the input waves to potentially existing waves in output folder. Otherwise (other value or omitting the optional argument), the existing waves will be replaced. Return value: 0 if the function doesn't crash. Requirements, to be considered: - Waves with names given by the optional argument 'VrWaves' have to exist in each of the folders (which are given by 'VrFrIn'). If the optional arguement 'VrWaves' is not used, the function will create 'VrWaves' as a string list with the names of the waves of the first input folder (cf. first element of 'VrFrIn'). - No care is taken whether the waves have the same length. Therefore it is up to the user to fill with empty lines in advance if necessary and desired. - The output folder must already exist. Existing waves in that folder will be replaced (if they have names as given by 'VrWaves', unless you choose optional arguement 'VrAppend=1', in which case the input data would be appended. - In case of missing waves, the functions is stopped by Igor, e.g. by showing the debugger. Example for usage - code for command line: +BB+ // Prepare some example data NewDataFolder/O/S root:FrBsp1; Make/O/D/N=5 Wv1=110+p, Wv2=120+p, Wv3=130+p; Make/O/T/N=5 WvT = "T1" + num2str(p) NewDataFolder/O/S root:FrBsp2; Make/O/D/N=5 Wv1=210+p, Wv2=220+p, Wv3=230+p; Make/O/T/N=5 WvT = "T2" + num2str(p) NewDataFolder/O/S root:FrBsp3; Make/O/D/N=5 Wv1=310+p, Wv2=320+p, Wv3=330+p; Make/O/T/N=5 WvT = "T3" + num2str(p) // Combine them NewDataFolder/O/S root:FrBspCombined1; print Tao_KlebeW1#F_KlebeFolderW1( "root:FrBsp1;root:FrBsp2;root:FrBsp3;", "root:FrBspCombined1" ) // combine all 3 waves NewDataFolder/O/S root:FrBspCombined2; print Tao_KlebeW1#F_KlebeFolderW1( "root:FrBsp1;root:FrBsp2;root:FrBsp3;", "root:FrBspCombined2", VrWaves="Wv2;WvT;" ) // combine only the waves 'Wv2' and 'WvT' print Tao_KlebeW1#F_KlebeFolderW1( "root:FrBsp1;root:FrBsp2;root:FrBsp3;", "root:FrBspCombined2", VrWaves="Wv2;WvT;", VrAppend=1 ) // append to existing output waves +BE+ ------------------------------------------------------------------- ++ F_StLaddps1: Adding prefix and suffix to each element of a string list ##F_StLaddps1, ------------------------------------------------------------------- This function can be used for adding a fix prefix and a fix suffix to each element of stringlist. The function had been created on 2013-12-06 by David Walter as part of file %dwrefA1%dc. On 2016-07-20, this function was copied here with only minor changes (e.g. variable names). Arguments of >> Static Function/S F_StLaddps1(VrPref,VrList,VrSuff,VrListSep) - String VrPref // The desired prefix, e.g. "Wv". If you do not want to add a prefix, use an empty string. - String VrList // String list, to which the prefix and the suffix shall be added, e.g. "time;Lon;Lat;speed;" - String VrSuff // The desired suffig, e.g. "_0". If you do not want to add a suffix, use an empty string. - String VrListSep // A single character which is used as the list separator, usually ";" Return value: A string list, e.g. "Wvtime_0;WvLon_0;WvLat_0;Wvspeed_0;" Example for usage - code for command line: +BB+ print Tao_KlebeW1#F_StLaddps1( "Wv", "time;Lon;Lat;speed;", "_0", ";" ) // prints "Wvtime_0;WvLon_0;WvLat_0;Wvspeed_0;" print Tao_KlebeW1#F_StLaddps1( "Wv", "time;Lon;Lat;speed;", "", ";" ) // prints "Wvtime;WvLon;WvLat;Wvspeed;" print Tao_KlebeW1#F_StLaddps1( "Wv", "time;Lon;Lat;speed;;", "", ";" ) // prints "Wvtime;WvLon;WvLat;Wvspeed;Wv;" +BE+ -------------------------------------------------------------------------------------------- +++ History of changes ##hice, -------------------------------------------------------------------------------------------- In the following, the changes within the code file 'KlebeW1.ipf' (@fI) and the relevant changes within this note file (@fN) shall be briefly mentioned. Normally, the behaviour of functions should not be changed, expect for clear bugs. Column 'R' of following table contains a 'X' for those modifications which may be relevant for the end user (and a '.' where not, and a 'n' for new functions or examples not affecting existing ones). Date Files L Description ---------- ------- - ---------------------------------- - 2016-07-20 @fI @fN . Start with development of @fI and @fN, First version put on server - 2016-08-31 @fN . Minor changes (e.g. example path 'C:\baustelle') - 2016-09-09 @fI @fN X Function 'F_KlebeFolderW1': Add 2 code lines - no, the function remains in the current data folder. - 2016-10-10 @fN . Minor things. - 2019-11-20 @fN . Minor things (correction of typos) [This is the last line of this file.]