Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to from I(x) to permutation and from permutation to I(x)

조회 수: 1 (최근 30일)
hang dong
hang dong 2019년 5월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
I have the following table:
I Permutation
0 0 1 2 3
1 0 2 3 1
2 0 3 1 2
.......
22 3 2 0 1
23 3 2 1 0
How to from I(x) to permutation and from permutation to I(x)
Exam I(2) -> Per (0 3 1 2)
per(3 2 0 1) -> I(22)
help me!
  댓글 수: 2
madhan ravi
madhan ravi 2019년 5월 22일
What are your inputs? and what is your desired output? Illustrate with an explicit example.

답변 (1개)

James Tursa
James Tursa 2019년 5월 22일
편집: James Tursa 2019년 5월 22일
E.g.,
>> Per
Per =
0 1 2 3
0 2 3 1
0 3 1 2
3 2 0 1
3 2 1 0
>> p
p =
0 3 1 2
>> x = find(ismember(Per,p,'rows'))
x =
3
>> Per(x,:)
ans =
0 3 1 2
>> q = [3 2 0 1]
q =
3 2 0 1
>> x = find(ismember(Per,q,'rows'))
x =
4
>> Per(x,:)
ans =
3 2 0 1
  댓글 수: 4
hang dong
hang dong 2019년 5월 22일
haiz.PNG
q = [ 0 1 2 3 5 4]
x = find(ismember(T,q,'rows'))
error. help me!
hang dong
hang dong 2019년 5월 22일
Table A include column I and Per
Table B include column Per
How to use ismember statements?

Community Treasure Hunt

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

Start Hunting!

Translated by