Borrar filtros
Borrar filtros

Name Storage with Repeat loops

2 visualizaciones (últimos 30 días)
TS
TS el 29 de Abr. de 2015
Comentada: TS el 29 de Abr. de 2015
f=input('Enter First Name:')
l=input('Enter Last Name:')
for [f,l]
repeat
strvcat(f,l)
until f=Jed
end
I need help with this code, what I'm tying to do is store names in a loop until the name Jed is typed in. I thought this code would do the trick, but I am unsuccessful.
  2 comentarios
the cyclist
the cyclist el 29 de Abr. de 2015
Editada: the cyclist el 29 de Abr. de 2015
Are you using MuPAD? There is no "repeat ... until" structure within MATLAB.
TS
TS el 29 de Abr. de 2015
No, in fact, I found this from a source online.

Iniciar sesión para comentar.

Respuesta aceptada

James Tursa
James Tursa el 29 de Abr. de 2015
Use a while loop if you want to loop repeatedly until some condition is met. E.g.,
while( true )
f=input('Enter First Name:')
l=input('Enter Last Name:')
% Insert processing code here
if( strcmpi(f,'Jed') )
break;
end
end
  1 comentario
TS
TS el 29 de Abr. de 2015
Thank you! This helps so much.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by