Try to hide/show certain fields end with errors
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Barak
le 10 Nov 2022
Réponse apportée : Cris LaPierre
le 10 Nov 2022
I created a GUI using guide that looks like the image I added here.
I wanted to write a if-else block that test which radio button is selected and base on selction some input titles and their associated edit fields with be hidden ir visible respectivlty. I created a function using the the mouse right click menu when selecting the radio buttons group panel as I thught it should be related to what ever in that panel range. I added the whole fig and .m files as attachments.
Also after creating that fnc: function selectPanel_SelectionChangedFcn(hObject, eventdata, handles) and running the code:
(1) select different radio buttons in the pannel does not hide the fields it suppose to when the proper selection is made (1st button suppose to hide 3rd fields (fix text and ediable text)
(2) I am getting alot of errors that I was not getting befre creating that function
>> testHideAndShowByRadioBtn
Unrecognized function or variable 'figure1_CreateFcn'.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in testHideAndShowByRadioBtn (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)testHideAndShowByRadioBtn('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
Unrecognized function or variable 'selectPanel_CreateFcn'.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in testHideAndShowByRadioBtn (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)testHideAndShowByRadioBtn('selectPanel_CreateFcn',hObject,eventdata,guidata(hObject))
>>
0 commentaires
Réponse acceptée
Cris LaPierre
le 10 Nov 2022
You have added callback functions to your figure and your selection panel. Remove these, and the errors go away.
To remove, right click on the corresponding component in guide and select Property Inspector. In the new window that opens, locate the CreateFcn field and erase the value.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps 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!