Error in running GUI
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Satwik
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!