Question: How to write this matlab function? Write a function with the following header: function [sorted bookshelf] - my sort bookshelf (bookshelf) where bookshelf is a

How to write this matlab function?
 How to write this matlab function? Write a function with the

Write a function with the following header: function [sorted bookshelf] - my sort bookshelf (bookshelf) where bookshelf is a non-empty 2 times n cell array (you can assume than n > 0) where each column represents one book, in each of these columns, the value in the first row is a scalar of class double that represents the DDC number of the book (the first three digits only) and the value in the second row is a non-empty row vector of class char that represents the title of the book sorted bookshelf is a 2 times n cell array where each column represents one book using a format similar to the format used for the input parameter bookshelf. sorted bookshelf should represent the same list of books as bookshelf, except that the books should be sorted by increasing DDC number Books whose DDC number is set to NaN should come last If two or more books share the same DDC number, then they should be ordered in the alphabetical order of their title This rule also applies when two or more books have their DDC numbers set to NaN You are allowed to use Matlab's built-in function sort for this problem. This built-in function can sort in increasing order row vectors of class double, it can also sort in alphabetical order character strings placed in a 1 _ m cell array Note that the actual DDC system specifies that if two or more books share the same DDC number then they should be ordered in the alphabetical order of their author's last name. In this question, we use the book's title instead of the author's last name to sort books which have the same DDC number 9 = (422, 851, 825. 825, 'Where words come from', 'Poesies' 'Programming is useful, Go B9'}, >> sorted_bookshelf = my_sort_bookshe1f(bookshelf) sorted_bookshelf = 2 times 4 cell array 1422] 1825) 1 8251 [851] .progr3mmi, g is useful 'Poesie' 'Where words come from Go By rru* >> bookshelf{l, l) r NaN-sorted_bookshelf = 2x4 cell array I 8251 I 82511 851) I NaN] 'Go B9!' 'Programming is useful 'Poesies' 'Discard

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!