get(eventd​ata.NewVal​ue,'Tag') ===>>> Error ??? Attempt to reference field of non-structure array.

조회 수: 2 (최근 30일)
Hello, ¿somebody knows what is happening?
I can´t get the Selected data from a button group panel:
function uipanel8_SelectionChangeFcn(hObject, eventdata, handles)
Seleccion=get(eventdata.NewValue,'Tag')
It gives me the Error:
??? Attempt to reference field of non-structure array.
Error in ==> Leitungsseilen>uipanel8_SelectionChangeFcn at 878
Seleccion=get(eventdata.NewValue,'Tag')
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Leitungsseilen at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==> hgfeval at 65
evalin('base', fcn);
Error in ==> uitools.uibuttongroup.childAddedCbk>manageButtons
at 80
hgfeval(cbk, source, evdata);
??? Error while evaluating uicontrol Callback
I appreciate your help,
David

채택된 답변

David Dapuero
David Dapuero 2012년 5월 2일
I think that the reasson is for being a GUIDE GUI... it does not accept eventdata.NewValue
Instead of that I have used... get(hObject,'Tag') and this way it works.

추가 답변 (1개)

Daniel Shub
Daniel Shub 2012년 4월 30일
I am pretty sure that NewValue is not a typical field of the eventdata for a gui callback. Have you overloaded eventdata? Are you sure you do not want handles.NewValue, although that seems odd to me also.
  댓글 수: 3
Daniel Shub
Daniel Shub 2012년 5월 1일
Please post this as an answer and accept it.
Steven Bierer
Steven Bierer 2014년 4월 2일
For clarification to future readers of this post, the .NewValue field IS standard for certain ui components like button groups. To the original poster, I've come across problems using button groups correctly as well. I have noticed that a UI component (like a radio button) won't be handled by the button group's 'SelectionChangeFcn' if it has its own callback defined.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by