Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: trouble saving data structure to a file
Posted:
Nov 8, 2012 5:35 PM


"Steven_Lord" <slord@mathworks.com> wrote in message <k7b9r0$ahr$1@newscl01ah.mathworks.com>... > > > "Ben Ruppel" <brspam@cox.net> wrote in message > news:k7b6ao$q01$1@newscl01ah.mathworks.com... > > "Steven_Lord" <slord@mathworks.com> wrote in message > > <k7a66a$asf$1@newscl01ah.mathworks.com>... > > *snip* > > > Thank you very much, your solution worked. I'm not thrilled with creating > > a copy of A, B, and C since these are very large variables. > > Depending on what you're doing, you may not be creating an actual copy. > > http://www.mathworks.com/help/matlab/matlab_prog/memoryallocation.html > > The copyonwrite behavior may save you from actually making a copy. > > > How can you tell that handles.inputData is not a scalar struct variable? > > Variable names in MATLAB have four specific rules: > > http://www.mathworks.com/help/matlab/ref/isvarname.html > > 'handles.inputData' contains a period, which is not allowed in variable > names. That makes it an expression that when evaluated returns a variable. > If you assign the output of that expression to an identifier, that > identifier must be a valid variable name. > > > In Variable Editor both handles and handles.inputData are listed as "1x1 > > struct". Furthermore, they are both data "things" in matlab which contain > > multiple data structures and arrays and cell arrays. What makes the one > > different from the other? > > "Ben Ruppel" is the name you use to post to CSSM. > > "The person that posts to CSSM using the address 'brspam@cox.net' " refers > to you, but it is not your name. If I "evaluate" that expression by > searching CSSM, I can find your actual name. [Not the best of examples, as > anyone can spoof their email address, but hopefully good enough for > illustration purposes.] > > > Is there a way for me to make handles.inputData a scalar struct variable? > > For purposes of SAVE? Not without assigning it to a variable. > > > Or is the problem more that handles.inputData is an expression? If that > > is the case, is there a way to point to this data structure that does not > > count as an expression? > > If you're worried about memory, see above. > >  > Steve Lord > slord@mathworks.com > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
Hi Steve, Thank you for the information and the useful links. While I accept it as the truth, I still think it's a little odd and inconsistent that some functions aren't smart enough to figure out when an expression points to a variable. After all, if I were to create my own function, I could pass in a variable name or a data structure member reference / expression and the function would see both as the data that is being referenced. Oh well. Ben



