필터 지우기
필터 지우기

Sorting Columns of a table.

조회 수: 8 (최근 30일)
Isaac Osei Agyemang
Isaac Osei Agyemang 2018년 10월 8일
댓글: Guillaume 2018년 10월 8일
I have a table with two columns without any title, i want to sort the numbers in the table in an order. I've a ttached a picture of my table to the question.
  댓글 수: 5
Walter Roberson
Walter Roberson 2018년 10월 8일
graph() accepts numeric s and t arrays. categorical too I think.
Guillaume
Guillaume 2018년 10월 8일
Yes, the edges can be numeric (and usually are), the node names cannot be numeric.
However, looking at the discussion in the other identical question, that wx appears to be simply a copy of the Edge table, not something generated from the Node table, so you are right, the values in wx should be numeric.

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

답변 (2개)

KSSV
KSSV 2018년 10월 8일
Okay you can sort them in the way you want. Have a look on the function sort. With this you can sort.

Guillaume
Guillaume 2018년 10월 8일
편집: Guillaume 2018년 10월 8일
If you want to sort wx according to the numeric values:
[~, order] = sortrows(str2double(wx.EndNodes));
wx = wx(order, :);

카테고리

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