Cases duplicated on menu Matlab
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Madalena Francisco
am 9 Jan. 2023
Kommentiert: Voss
am 10 Jan. 2023
%I´m building this program, and i repeat 'case 2' but it´s for 2 different
%menus I tried to change for a text name the cases to not repeat the '2', but I think that menu
%recognize just numbers... so I don´t know what I could do... appears a
%message error saying that the cases are duplicated
%the first case 2 it´s for b1 menu
% the other one it´s for a1 menu
%Thank u!
a1=menu({'This program allows the fitting of functions to experimental points.', ...
'To start the program, click on the Start button.'},'Start','Exit');
while a1<=2
switch a1
case 1
b1= menu('How do you intend to insert the experimental points?', ...
'By a file','Manually','Back','Exit');
switch b1
case 2
prompt2= {'How many experimental values do you want to input?'};
title = 'Number of experimental values';
numlines=1;
ret = {' '};
answer = inputdlg(prompt2,title,numlines,ret);
case 3
a1=menu({'This program allows the fitting of functions to experimental points.', ...
'To start the program, click on the Start button.'},'Start','Exit');
case 4
break
case 2
break
end
end
end
0 Kommentare
Akzeptierte Antwort
Voss
am 10 Jan. 2023
You need an "end" after "case 4, break" and before "case 2, break", to close out the "switch b1" block. And then you will need to delete one of the "end"s at the end.
switch a1
case 1
b1 = menu() % ...
switch b1
case 2
% ...
case 3
% ...
case 4
% ...
end % <- was missing
case 2
% ...
end
2 Kommentare
Weitere Antworten (0)
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!