Saving a struct to a data folder
tweed
I am interested in saving a struct to a data folder. For a string, I *can* do:
NewDataFolder/O/S $"root:Folder"
String root:folder:str = "foo"
String root:folder:str = "foo"
Is there something analogous for structs? I'ver tried the following with no success:
Structure StructA
Variable foobar
EndStructure
NewDataFolder/O/S $"root:Folder"
Struct root:folder:StructA bar // "No Such Structure Exists"
Struct StructA root:folder:bar // "Expected ";" or <cr>"
Variable foobar
EndStructure
NewDataFolder/O/S $"root:Folder"
Struct root:folder:StructA bar // "No Such Structure Exists"
Struct StructA root:folder:bar // "Expected ";" or <cr>"
If not, are there any alternatives? One seems to be to just use waves,strings, and variables, but I'm trying to be organized for a large run of independent data sets, so a struct seemed natural.
Thanks!
displayhelptopic "Limitations of Structures"
"A structure variable, like all local variables in functions, disappears when its host function returns. In order to maintain state information, you will need to store and retrieve structure information using global variables."
I also miss this feature ...
HJ
June 8, 2015 at 09:03 am - Permalink
Read the help info for StructPut for details to see if this fits your case.
June 8, 2015 at 10:48 am - Permalink
June 8, 2015 at 12:11 pm - Permalink
EDIT 6/9/15: It didn't occur to me that you can store strings as numeric types by using character arrays (see http://www.igorexchange.com/node/6528, or look at The "WaveSelectorListInfo" Structure in "WaveSelectorWidget". I will probably refactor my existing code to make this work. Thanks again
June 9, 2015 at 03:23 pm - Permalink