All blocks in this if statement are identical. (error in running GUI)
Afficher commentaires plus anciens
Hi, I'm new in GUI and not familiar with the command. When I try to run my GUI It always show 'All blocks in this if statement are identical. Avoid identical blocks to prevent unexpected behavior.' Wh does it happen and how to solve it?
% Button pushed function: checkButton
function checkButtonPushed(app, event)
%for normal skin is chosen
app.NormalSkinButton.Value = true;
for i = app.NormalSkinButton.Value
%control statement for skin problem
%the selected skin problem will display the specific solution
%fix image with size of axes
if app.AcneButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
elseif app.DullnessButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
else
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
end
end
%for sensitive skin is chosen
app.SensitiveSkinButton.Value = true;
for i = app.SensitiveSkinButton.Value
%control statement for skin problem
%the selected skin problem will display the specific solution
%fix image with size of axes
if app.AcneButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
elseif app.DullnessButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
else
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
end
end
Réponses (1)
Jan
le 26 Juin 2021
Were does this message occur?
I do noit understand the purpose of your code also. Your code:
for i = app.NormalSkinButton.Value
%control statement for skin problem
%the selected skin problem will display the specific solution
%fix image with size of axes
if app.AcneButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
elseif app.DullnessButton.Value == true
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
else
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
end
end
does exactly the same as:
im = imread('skin.jpg','Border', 'tight');
imagesc(app.UIAxes,im);
I assume the code analyser sees this simplification also and gives an advice.
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!