I need to write a script that will prompt the user for four course numbers. Each will be a string of length 5 of the form ‘CS101’. These strings are to be stored in a character matrix.
3 ビュー (過去 30 日間)
古いコメントを表示
Don't really know how to store as a character matrix
0 件のコメント
回答 (1 件)
Chris C
2014 年 3 月 17 日
This can be done in a structure setting as well which would probably make storage and recall easier, but to answer your question you could just use the below:
CourseNums = cell(1,4);
for i =1:4
display('Please enter your course numbers: ');
CourseNums{i} = input(sprintf('Course %d: ',i),'s');
end
CourseNums
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!