No public field [variable] exists for class matlab.ui.container.toolbar.PushTool. ERROR
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all,
We changed to Windows 10 and R2015a (was windows 7 with R2014a) and since then my program does not work anymore properly.
I have a gui which opens a function. This function creates a figure and the figure contains an pushtool in the toolbar because of the following code:
hGinput = uipushtool('cdata',cdata_gin, 'tooltip','Select startingpoint exercise','ClickedCallback',{@NIRS_OFFSET_FUNC,handles},'Separator','on');
The subsequent called function is as follows:
function NIRS_OFFSET_FUNC(handles,~,~)
hMainGui=getappdata(0,'hMainGui');
handles.t = getappdata(hMainGui,'t');
However, when I run my program it keeps getting the failure:
No public field t exists for class matlab.ui.container.toolbar.PushTool.
Error in NIRS_OFFSET_NIRS_OFFSET_FUNC (line 205)
handles.t = getappdata(hMainGui,'t');
I never had such failure and I can't find a proper solution on the internet.
Does it have to do with the uipushtool or with gathering the appdata??
Can somebody help me :)?
0 件のコメント
回答 (1 件)
Steven Lord
2015 年 8 月 24 日
What do you expect hMainGui to be? I suspect from the name that you expect it to be the handle to the GUI figure, but it's the handle of the uipushtool. You didn't show the code that set the application data of the root object (by the way, that's a bad idea IMO; you're giving anyone with access to the root object [i.e. everyone] the ability to break and/or hijack your GUI.)
If you want to obtain the handles to your main GUI and to your uipushtool, they're probably stored in the handles structure that was passed into NIRS_OFFSET_FUNC as the first input argument (if you wrote this GUI using Guide or used GUIHANDLES and GUIDATA in your programmatic GUI.)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!