How do I sort all the columns of a table based on the first column?
    6 views (last 30 days)
  
       Show older comments
    
    Bhavishey Thapar
 on 20 Jul 2022
  
    
    
    
    
    Commented: Bhavishey Thapar
 on 20 Jul 2022
            I am trying to sort a table which contains datetime values in the first column and corresponding temperatures in the second column. I want to sort the table by datetime without affecting the relationship between datetime and the temperatures.
For example, if a table looks like this:
Date                    Temperature
2022-06-01            21
2022-05-29            18
2022-05-21            19
2022-06-04            25
2022-06-02            22
I want it to be sorted like below:
Date                    Temperature
2022-05-21            19
2022-05-29            18
2022-06-01            21
2022-06-02            22
2022-06-04            25
How do I achieve this?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
				Find more on Shifting and Sorting Matrices in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
