Hello, I am generating a code for adding books to a library. However the first if statement if chosen but the last two elseif statements are not chosen. The program reads as green and technically should work but it doesn't work in matlab. The error I get is matrix dimensions do not agree.
function libraryprompt=input('What would you like to do: ', 's');while prompt >=' ' prompt=input('What would you like to do: ', 's');if prompt == 'add book' title=input('Title: ', 's'); author=input('Author: ', 's'); pages=input('Number of Pages: ', 's'); fprintf('%s, %s, %s has been added to the library\n', title, author, pages)elseif prompt == 'quit' disp('Good-bye')elseif prompt== 'list books' title=input('Title: ', 's'); author=input('Author: ', 's'); pages=input('Number of Pages: ', 's');end endend
Best Answer