Borrar filtros
Borrar filtros

Cases duplicated on menu Matlab

2 visualizaciones (últimos 30 días)
Madalena Francisco
Madalena Francisco el 9 de En. de 2023
Comentada: Voss el 10 de En. de 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

Respuesta aceptada

Voss
Voss el 10 de En. de 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 comentarios
Madalena Francisco
Madalena Francisco el 10 de En. de 2023
Wow!!! It works!! Thanks a lot again Voss!! U saved my program!
Voss
Voss el 10 de En. de 2023
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Time Series Events en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by