フィルターのクリア

problem with if and or

2 ビュー (過去 30 日間)
theo Rodriguez
theo Rodriguez 2022 年 4 月 20 日
コメント済み: theo Rodriguez 2022 年 4 月 20 日
Hello i have a little problem i really don't understand why my code don't open a popup window when i press 'interp'
someone can help me ?
Choix1 = questdlg('Veuillez choisir un mode de fonctionnement du programme :', 'Menu Principal', 'Demo', 'Projet', 'Quitter', 'Quitter');
if Choix1 == 'Projet'
ChoixOption = questdlg('Veuillez choisir un mode de fonctionnement du Projet :', 'Menu du Projet', 'interp', 'zero-padding', 'lineaire', 'lineaire');
end
if ChoixOption == 'zero-padding'
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
elseif ChoixOption == 'interp'
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
endif

採用された回答

langrg
langrg 2022 年 4 月 20 日
編集済み: langrg 2022 年 4 月 20 日
Hello,
You should use "strcmp" instead of "==", then end syntax of an "if" condition is "end" not "endif", like that:
Choix1 = questdlg('Veuillez choisir un mode de fonctionnement du programme :', 'Menu Principal', 'Demo', 'Projet', 'Quitter', 'Quitter');
if strcmp(Choix1, 'Projet')
ChoixOption = questdlg('Veuillez choisir un mode de fonctionnement du Projet :', 'Menu du Projet', 'interp', 'zero-padding', 'lineaire', 'lineaire');
end
if strcmp(ChoixOption, 'zero-padding')
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
elseif strcmp(ChoixOption, 'interp')
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
end
  1 件のコメント
theo Rodriguez
theo Rodriguez 2022 年 4 月 20 日
Thank you very much for your help

サインインしてコメントする。

その他の回答 (1 件)

Murugan C
Murugan C 2022 年 4 月 20 日
Hi, to compare string, use strcmpi keyword.
Please find below code.
Choix1 = questdlg('Veuillez choisir un mode de fonctionnement du programme :', 'Menu Principal', 'Demo', 'Projet', 'Quitter', 'Quitter');
if strcmpi(Choix1, 'Projet')
ChoixOption = questdlg('Veuillez choisir un mode de fonctionnement du Projet :', 'Menu du Projet', 'interp', 'zero-padding', 'lineaire', 'lineaire');
end
if strcmpi(ChoixOption, 'zero-padding')
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
elseif strcmpi(ChoixOption, 'interp')
ChoixTaux = questdlg('Veuillez choisir un taux de sur-échantillonage :', 'Menu sur-échantillonage', '2', '3', 'Quitter', 'Quitter');
end
  1 件のコメント
theo Rodriguez
theo Rodriguez 2022 年 4 月 20 日
Thank you very much for your help

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by