visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each [2024/07/12 13:30] – removed sgranger | visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each [2024/09/03 13:57] (current) – [Command Syntax] wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== For Each and End For Each ====== | ||
+ | |||
+ | Executes pipeline commands multiple times for each item in a list of items. It is not identical with a "for loop" or "do loop" in a programming language because the items must be explicitly defined as ITEMS in the command. This has some powerful consequences because it means that you can " | ||
+ | |||
+ | ==== Command Syntax ==== | ||
+ | |||
+ | < | ||
+ | For_Each | ||
+ | / | ||
+ | !/ | ||
+ | /Items= ITEM1+ITEM2+ITEM3 | ||
+ | ; | ||
+ | |||
+ | ! Starting from the For_Each command and ending at the End_For_Each command | ||
+ | ! the loop is repeated once for each item in the For_Each command at each | ||
+ | ! loop INDEX is a pipeline command this is identified as ::INDEX in any other command | ||
+ | |||
+ | End_For_Each | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | As of version 5.02.17, a new parameter " | ||
+ | |||
+ | ==== Example: Compute the GLOBAL mean value of a signal for each of 3 tags ==== | ||
+ | |||
+ | This example computes the GLOBAL mean value of a signal for each of 3 tags (TAG1, TAG2, TAG3) and adds the TAG name to the GLOBAL signal names that are created. | ||
+ | |||
+ | < | ||
+ | For_Each | ||
+ | / | ||
+ | /Items= TAG1+TAG2+TAG3 | ||
+ | ; | ||
+ | |||
+ | Select_Active_File | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Metric_Mean | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | End_For_Each | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ==== Example: Implementing a while loop ==== | ||
+ | |||
+ | Visual3D doesn' | ||
+ | |||
+ | < | ||
+ | Variable blnContinue = true | ||
+ | While Continue = true | ||
+ | Prompt user for variable blnContinue (true or false) | ||
+ | FileCounter = FileCounter +1 | ||
+ | [load and process another file (e.g. filename_filecounter)] | ||
+ | End while | ||
+ | </ | ||
+ | ==== Example: Processing many files ==== | ||
+ | |||
+ | First create a pipeline parameter that contains all of the filenames selected (e.g. all files that have the same TAG) concatenated into a string. | ||
+ | |||
+ | < | ||
+ | Set_Pipeline_Parameter_To_List_Of_Tagged_Files | ||
+ | / | ||
+ | /TAG_NAME= ALL_MALES | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | ! Now set up the for each loop using this string | ||
+ | |||
+ | For_Each | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | ! Put any command that you like into this location | ||
+ | |||
+ | End_For_Each | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ! **NOTE:** Filenames do not have to be in any sequence or have any special naming convention. | ||
+ | |||
+ | ==== Exporting multiple files ==== | ||
+ | |||
+ | Using [[# | ||
+ | |||
+ | [[Visual3D: | ||
+ | |||
+ | [[Visual3D: | ||
+ | |||
+ | |||
visual3d/documentation/pipeline/pipeline_commands/for_each_and_end_for_each.1720791055.txt.gz · Last modified: 2024/07/12 13:30 by sgranger