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

1 回表示 (過去 30 日間)
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!

採用された回答

Adam
Adam 2017 年 6 月 22 日
編集済み: Adam 2017 年 6 月 22 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by