The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 18,038
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
> 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.


Steve Lord
To contact Technical Support use the Contact Us link on

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.