"Ben Ruppel" <email@example.com> wrote in message news:firstname.lastname@example.org... > Hello, > The save command is driving me crazy. I am working in a GUI where I am > storing some data variables in the handles data structure. I have > collected the data I wish to export into a structure called > handles.inputData. handles.inputData contains three structures, which are > called A, B, C. Each of these contains several other structures and > arrays. > I want to export A, B, and C to a file, but I keep getting "The argument > to -STRUCT must be the name of a scalar structure variable." > > I have a variable called "filename" which contains a path and name of an > output file. > > The command: save(filename, '-struct', 'handles.inputData.A') does not > work.
handles.inputData.A is not the name of a scalar structure variable. It is an expression that when evaluated returns a scalar struct array. Those are two different things.
> The command: save(filename, '-struct', 'handles.inputData') does not > work.
> The command: save(filename, '-struct', 'handles') does work.
handles IS the name of a scalar struct array and so is acceptable for use with the -struct flag.
> handles.inputData is confirmed to be a "1x1 struct" in the Variable Editor > window. > > Can anyone help me understand what is going wrong here and show me how to > save my structures?
D = handles.inputData; save(filename, '-struct', 'D')