Why i can't request user sting input?

n = input('Enter the number of students');
for i=1:1:n
name(i) = input('What is your name? :','s');
end

 采纳的回答

Image Analyst
Image Analyst 2012-3-12
Since the names may be different lengths name needs to be a cell array. Try name{i} instead of name(i).

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Import, Export, and Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by