GUI problem with uitable and figure

1 回表示 (過去 30 日間)
VBBV
VBBV 2018 年 6 月 24 日
コメント済み: VBBV 2018 年 6 月 24 日
I have a GUI with a uitable with tag uitable1 and I placed some code accessing the figure handle in the uitable1_createFcn
when I run the GUI, it shows me the following error, undefined function or variable figure1 / uitable1

採用された回答

Walter Roberson
Walter Roberson 2018 年 6 月 24 日
CreateFcn of anything stored with the GUIDE .fig file, execute before the handles structure has been created.
If you want to use CreateFcn to access the handles structure, then you cannot create the object until at least the OpenFcn.
The order that the various CreateFcn execute when loading a .fig is not specified, so do not count on anything else having been created.
What you should probably do is put the relevant code into the OpenFcn, which will not execute until after the CreateFcn have all been executed and the handles structure has been created.
  6 件のコメント
Walter Roberson
Walter Roberson 2018 年 6 月 24 日
At the end of your .m, replace the lines
f = figure1
s = {'Name of Student','Subject','Credits','Mid-I','Mid-II','Mid-III','Best','Assign','Total (Max Marks-40)','Credits scored'}
t = uitable1(f,'ColumnName',s)
with
s = {'Name of Student','Subject','Credits','Mid-I','Mid-II','Mid-III','Best','Assign','Total (Max Marks-40)','Credits scored'}
set(hObject, 'ColumnName', s);
VBBV
VBBV 2018 年 6 月 24 日
Thank you ... it works fine now

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by