sorting data in a nested cell
4 次查看(过去 30 天)
显示 更早的评论
I have a cell C that looks like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197398/image.png)
The cells in the first column are all some numberx14. I want to sort C in ascending order based on the values of the first column of data in the cells in the first column of cell C. How would I go about doing that? I'm getting very confused with indexing for cells like this and just want to rearrange the cell.
0 个评论
采纳的回答
amin ya
2018-10-9
编辑:amin ya
2018-10-9
You need to write a for loop and use classic sort algorithm. I had this problem, but there is no easy way to access or sort the data of matrixes inside the cell.
For example, you can access the first element of a matrix in the (1,1) element of the cell like this:
A{1,1}(1,1)
Change these algorithms to suit your application:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!