Name Storage with Repeat loops

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 Comments

the cyclist
the cyclist on 29 Apr 2015
Edited: the cyclist on 29 Apr 2015
Are you using MuPAD? There is no "repeat ... until" structure within MATLAB.
No, in fact, I found this from a source online.

Sign in to comment.

 Accepted Answer

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

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

TS
on 29 Apr 2015

Commented:

TS
on 29 Apr 2015

Community Treasure Hunt

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

Start Hunting!