concatenate_strings_in_input_file
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
concatenate_strings_in_input_file [2010/10/01 15:30] – johnsoevans | concatenate_strings_in_input_file [2022/11/03 15:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Joining strings in an input file ====== | ||
+ | You can concatanate strings in a text file to build up complex filenames etc using the following: | ||
+ | |||
+ | <code topas> | ||
+ | macro file_stem {dataname_} | ||
+ | macro run_number {0000} | ||
+ | macro suffix {.xy} | ||
+ | |||
+ | macro file_dets(data_directory, | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | macro file | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | |||
+ | file</ | ||
+ | |||
+ | which will expand to: | ||
+ | |||
+ | <code topas> | ||
+ | </ | ||
+ | The ## concatenation sequence is a c pre-processor construct and only concatenates macro arguments hence the double step. | ||
+ | |||
+ | |||
+ | Similarly you can e.g. change the name of an output .xy file with macros like: | ||
+ | |||
+ | <code topas> | ||
+ | |||
+ | macro File_Out_(n) | ||
+ | { | ||
+ | voigt## | ||
+ | } | ||
+ | |||
+ | Out_X_Ycalc(File_Out_(lor))</ |