Question: How to write matlab function that can sort bookshelf corresponding to its number? Write a function with the following header: function [sorted bookshelfl my sort

How to write matlab function that can sort bookshelf corresponding to its number?  How to write matlab function that can sort bookshelf corresponding to

Write a function with the following header: function [sorted bookshelfl my sort bookshelf(bookshelf) where bookshelf is a non-empty 2 x n cell array (you can assume than n 0) where each column represents one book. In each of these columns, the value in the rst row is a scalar of class double that represents the DDC number of the book (the rst 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 xn cel array where each column represents one book using a format similar to the format used for the input parameter bookshelf. sorted 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 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 speci es 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. Test cases: bookshelf (422, 851, 825, 825, 'where words come from Poesie', 'Programming is useful', 'Go B9!') sorted bookshelf my sort bookshelf(bookshelf) sorted bookshelf 2x4 cell array [42211825] [825] [851] useful 'Poesie where words come from Go B9!' 'Programming is bookshelf 1,1) NaN bookshelff2,1) Discard' sorted bookshelf my sont bookshelf(bookshelf) sorted bookshelf 2x4 cell array 'Go B9!' 'Programming is useful' 'Poesie' '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!