Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: MATLAB Concatenation Rules for objects
Replies: 4   Last Post: May 9, 2013 9:41 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: MATLAB Concatenation Rules for objects
Posted: May 9, 2013 9:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



<kzelechowski@e3tech.local> wrote in message
news:518b482c$0$26708$65785112@news.neostrada.pl...
> I am trying to keep a pointer and numeric values in a 'UserData' property.

I recommend either a struct array or a cell array (or if you want to get
really crazy, both as with mydata.listOfMatrices below.)

mydata.mypointer = libpointer;
mydata.handleOfRoot = 0;
mydata.listOfMatrices = {magic(4), zeros(7), gallery('moler', 5)};
set(gcf, 'UserData', mydata)
clear mydata
x = get(gcf, 'UserData')

Cell arrays and struct arrays are designed to contain multiple types and
sizes of data independent of one another. When you store two arrays of
different types, sizes, or attributes in an array that is not a cell or
struct, at least one of the arrays is usually going to have to change.

> I was not using pointers before and the value could be an array but I
> cannot add a pointer to an array so I am trying to figure out what is
> going on and why. I acknowledge your objection that the function handle
> is undocumented, so my example is void, I am unable to come up with
> another one and I should not be so nosey.


It's not so much that you were being "nosey", I wanted to see if there was a
way to do what you were really after without using undocumented
functionality like the HANDLE function. I don't really want to discuss
undocumented functionality if I can help it, much to Yair's disappointment
;) It turns out there is a way to achieve your ultimate goal using just
documented functionality, as I mentioned above.

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.