order matrix elements and extract the n th element

조회 수: 2 (최근 30일)
Lorenzo
Lorenzo 2014년 12월 4일
댓글: Lorenzo 2014년 12월 4일
Dear experts, I have this problem:
I need to sort in ascending order all the elements of a matrix.
I have 26 matrices that are inside a cell-array (26x1). And I have to do this operation (sorting) for all these matrices.
After that, I need to put inside another cell-array the nth (3rd, for example) element of each matrix inside this new cell-array, in the same position of original matrix.
I'll do an easy example:
My cell array (2,1) is composed by 2 matrices, A and B, A in position (1,1) and B (2,1)
A = [1 4
3 9]
B = [6 9
3 8]
I need to create new cell-array (2,1), in which I'll have 4 in position (1,1) and 8 in position (2,1).
Thanks in advance for you help.
Lorenzo

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 4일
A = [1 4
3 9]
B = [6 9
3 8]
c={A,B}
c{1}(1,1)=4
c{2}(2,1)=8
  댓글 수: 1
Lorenzo
Lorenzo 2014년 12월 4일
Thanks,
but my real matrices are 85x85, not 2x2. I need an algorithm that sorting and after choose 3rd element of the list from every matrices. I can't choose "manually" the 3rd value from 7225 elements.
Other ideas?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by