Error in running GUI
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Satwik
el 24 de Abr. de 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 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!