フィルターのクリア

Name Storage with Repeat loops

2 ビュー (過去 30 日間)
TS
TS 2015 年 4 月 29 日
コメント済み: TS 2015 年 4 月 29 日
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 件のコメント
the cyclist
the cyclist 2015 年 4 月 29 日
編集済み: the cyclist 2015 年 4 月 29 日
Are you using MuPAD? There is no "repeat ... until" structure within MATLAB.
TS
TS 2015 年 4 月 29 日
No, in fact, I found this from a source online.

サインインしてコメントする。

採用された回答

James Tursa
James Tursa 2015 年 4 月 29 日
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 件のコメント
TS
TS 2015 年 4 月 29 日
Thank you! This helps so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by