Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.
Input = [1 2 3 4 5;
4 3 1 2 2]'
Output = [3 4 5 2 1]'
Please! Can you explain more than that?
Aye! The first column is not "sorted according the second column" (only half an explanation). The block of numbers in each row is treated as a fixed unit, and each row is rearranged such that the values in the second column are sorted in ascending order.
Project Euler: Problem 10, Sum of Primes
Back to basics 15 - Benchmark
Return the Fibonacci Sequence
Rotate a Matrix
Insert zeros into vector
function on a moving window
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