Differences
This shows you the differences between two versions of the page.
documentation:language_reference:objects:spectra:functions:clone [2016/09/25 23:23] – created Maurits W. Haverkort | documentation:language_reference:objects:spectra:functions:clone [2016/10/10 09:41] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Clone ====== | ||
+ | ### | ||
+ | Creates a copy of the spectrum. The input //G1 = G2// creates two pointers to the same object. Changing //G1// will change //G2//. // | ||
+ | ### | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | ### | ||
+ | The following example creates a clone of //G// and stores this in the variable //GClone//. Next it sets //G2// equal to //G//. Shifting //G2// will also lead to a shift in //G//. //GClone// is independent of //G//. | ||
+ | ### | ||
+ | |||
+ | ==== Input ==== | ||
+ | <code Quanty Example.Quanty> | ||
+ | dofile(" | ||
+ | |||
+ | GClone = Spectra.Clone(G) | ||
+ | G2 = G | ||
+ | G2.Shift(0.5) | ||
+ | |||
+ | G.Print({{" | ||
+ | G2.Print({{" | ||
+ | GClone.Print({{" | ||
+ | |||
+ | gnuplotScript = gnuplotHead .. [[ | ||
+ | set output " | ||
+ | plot " | ||
+ | " | ||
+ | " | ||
+ | ]] | ||
+ | |||
+ | file = io.open(" | ||
+ | file: | ||
+ | file: | ||
+ | |||
+ | os.execute(" | ||
+ | os.execute(" | ||
+ | </ | ||
+ | |||
+ | ==== Result ==== | ||
+ | The resulting picture is: | ||
+ | {{: | ||
+ | |||
+ | ===== Available functions ===== | ||
+ | {{indexmenu> |