Is it possible to create your own structure array in a GUI that can be referenced within the GUI?

5 visualizaciones (últimos 30 días)
I created my own structure array under a pushbutton so that I could store a lot of data collected in an organized manner. I tried referencing this structure in a subsequent pushbutton, but received an error "undefined function or variable".
  • Does anyone know if I can reference my own structure array throughout the GUI?
  • Do I need to reference it through handles?
  • Is there an easier way to do this through handles alone?
Here's a sample of some of the code:
PS(1).TLP = [fA, Ph, fFr, DF, Fr, Ds];
PS(1).Bm= [fKa, Dk, fDt, fFa];
PS(1).sp = [fp, fk, nPSe, A2, A1, A0, ScK];
This goes on and on..
Thanks!

Respuesta aceptada

Adam
Adam el 22 de Jun. de 2017
Editada: Adam el 22 de Jun. de 2017
Just add your structure to 'handles' as follows
handles.PS = PS;
guidata( hObject, handles )
then you can access it in any callback that has handles as
handles.PS
As for the question if it is easier through handles alone: No, not really. Having your own structure attached to handles is neater than piling a vast amount of raw data onto the handles struct.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by