Since the names may be different lengths name needs to be a cell array. Try name{i} instead of name(i).
Why i can't request user sting input?
2 次查看(过去 30 天)
显示 更早的评论
n = input('Enter the number of students');
for i=1:1:n
name(i) = input('What is your name? :','s');
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!