Creating a column vector of strings of various sizes

15 次查看(过去 30 天)
hey so as the title says, I need to create a database / 'library'. I need to save each 'book' entered by the user ( the total amount of books entered is unknown, i.e. can enter as many as they want)into a vertical vector. Ive tried using strvcat and char and other methods to add elements to an empty vector but I keep getting dimension errors. Please help
cheers

采纳的回答

KSSV
KSSV 2018-4-9
books = cell(3,1) ;
books{1} = 'MATLAB';
books{2} = 'MAT';
books{3} = 'LAB';
Read about cell
  3 个评论
KSSV
KSSV 2018-4-9
books = cell([],1) ;
for i = 1:3
book = input('Book Name:','s') ;
books{i,1} = book ;
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by