typestar

Data folders in Igor Pro

Igor's experiment is a tree, and data folders are how an analysis keeps its work apart.

Function AnalyzeIn(String folderName)
    DFREF saved = GetDataFolderDFR()

    NewDataFolder/O/S $folderName
    Make/O/N=100/D result = p^2

    DFREF here = GetDataFolderDFR()
    WAVE result = here:result
    Printf "%s holds %d points\r", GetDataFolder(0), numpnts(result)

    SetDataFolder saved
End

How it works

  1. NewDataFolder/O makes one; SetDataFolder moves the current one.
  2. A DFREF holds a folder the way a WAVE holds a wave.
  3. Save and restore the current folder, or you leave the user somewhere else.

Keywords and builtins used here

The run, in numbers

Lines
12
Characters to type
278
Tokens
54
Three-star pace
80 tpm

At the three-star pace of 80 tokens a minute, this run takes about 40 seconds.

Type this snippet

Step 2 of 2 in Where data lives, step 17 of 18 in Language basics.

← Previous Next →