I do not understand why this code failed assertion test even though it yields the correct answer
function mpg = sort_cars(N)
sorted = sortrows (cars,4)
n = N
mpg = sorted(1:n,2)
The output is expected to be a column vector, whereas your code returns a table.
I tried for the solution nearly 20 ways but didn't work. finally took help from the Matlab community and compleated it
Find the treasures in MATLAB Central and discover how the community can help you!
Select a Web
Choose a web site to get translated content where available and see local events and
offers. Based on
your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country
sites are not optimized for visits from your location.
Contact your local office