Name Storing in a While Loop
2 次查看(过去 30 天)
显示 更早的评论
while (true)
f=input('Enter First Name:','s');
l=input('Enter Last Name:','s');
s1=strvcat(f,l)
if( strcmpi(f,'Jed') );
break
end
end
I need help here. My goal with this code is to be able to store names using the command strvcat. However, I'm having trouble integrating it. Any suggestions?
采纳的回答
James Tursa
2015-4-29
E.g., using a cell array of strings,
names = cell(0,2);
while (true)
f=input('Enter First Name:','s');
l=input('Enter Last Name:','s');
names(end+1,:) = {f l};
if( strcmpi(f,'Jed') );
break
end
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!