How to add a property to the handles?

6 visualizaciones (últimos 30 días)
Michael Adelman
Michael Adelman el 10 de Jul. de 2012
I'm creating GUI using guide. I added a new handles, but it does not contain any property (like struct). Please advice.

Respuesta aceptada

Arthur
Arthur el 10 de Jul. de 2012
So your code is:
handles.edit1 = 0;
This way you don't create an object, you simply add a field to the structure "handles", with value 0. I think you misunderstand the concept of handles. A handle is merely a number to refer to an object. The handle itself does not contain any properties. In addition, you can't add properties to an object: all properties are defined by the type of object.

Más respuestas (3)

Luffy
Luffy el 10 de Jul. de 2012
Let me explain it for an edit box(assuming Tag is 1)
x = get(handles.edit1,'String');
set(handles.edit1,'String',z);
Now similarly use get & set to get & set properties via handles of Objects

Michael Adelman
Michael Adelman el 10 de Jul. de 2012
If I understood correctly, 'String' is a property? if yes, then you explained how to set and get value of a string. I'm looking how to add 'String' (which is a property) to a handle that doesn't has any properties.
In other words: assume that I'm at the Demo_OpeningFcn (GUI) and I write a s follows:
handles.edit1 = 0;
. . .
how to handles.edit1 add a property?

Michael Adelman
Michael Adelman el 10 de Jul. de 2012
So you saying that I need to create an object first and then assign it to handle?

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by