Error in running GUI
26 views (last 30 days)
Show older comments
Hi everyone, I got problem in runnin GUI. The 'selected Button' always show Unrecognized method, property, or field 'selectedButton' for class 'skin'.
% Selection changed function: SkinProblemButtonGroup
function SkinProblemButtonGroupSelectionChanged(app, event)
%turn on the button
selectedButton = app.SkinProblemButtonGroup.SelectedObject;
switch app.selectedButton.Text
case 'Hyperpigmentation'
app.HyperpigmentationButton.Value = true;
case 'Acne'
app.AcneButton.Value = true;
case 'Dullness'
app.DullnessButton.Value = true;
end
But in previous part, there is no problem with this commad
% Selection changed function: SkinTypeButtonGroup
function SkinTypeButtonGroupSelectionChanged(app, event)
%turn on the button
selectedButton = app.SkinTypeButtonGroup.SelectedObject;
switch selectedButton.Text
case 'NormalSkin'
app.NormalSkinButton.Value = true;
case 'CombinationSkin'
app.CombinationSkinButton.Value = true;
case 'DrySkin'
app.DrySkinButton.Value = true;
case 'OilySkin'
app.OilySkinButton.Value = true;
case 'SensitiveAkin'
app.SensitiveSkinButton.Value = true;
end
Can anyone tell me what's the problem? Thank you
0 Comments
Answers (1)
Satwik
on 24 Apr 2025
The error occurs due to the following line in the code:
switch app.selectedButton.Text
Here, 'selectedButton' is being referenced as a property of 'app' (app.selectedButton), but in the function, 'selectedButton' is defined as a local variable.
Therefore, the correct approach is to use the local variable directly, as:
switch selectedButton.Text
I hope this helps resolve the issue.
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!