Cases duplicated on menu Matlab

4 次查看(过去 30 天)
%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

采纳的回答

Voss
Voss 2023-1-10
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time Series Events 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by