Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
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!

Réponse acceptée

Adam
Adam le 22 Juin 2017
Modifié(e) : Adam le 22 Juin 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.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by