concatenate_strings_in_input_file
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| concatenate_strings_in_input_file [2011/06/16 16:51] – johnsoevans | concatenate_strings_in_input_file [2025/09/19 15:18] (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))</ | ||