Cases duplicated on menu Matlab
조회 수: 2 (최근 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
댓글 수: 0
채택된 답변
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 Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!