필터 지우기
필터 지우기

elemental subtraction indices of initial vector

조회 수: 1 (최근 30일)
Mahla Bakhshi
Mahla Bakhshi 2020년 9월 18일
답변: madhan ravi 2020년 9월 18일
Hi !
A is my array of numbers
I substract all the elements from each other with A - A' which give me a matrice T with size of length (A) * length (A)
Now that I want to look for specific value in this matrice, find (T == x) it gives me the indices of the value in the matrice.
My question is how can I find out what this indece represents in form of my initial array A?
in short :::
T = A - A '
find (T == my value) ==> ans = i where T (i) == my value
how to find out j and k where T (i) = A (j) - A (k)
Thanks in advance!

채택된 답변

KSSV
KSSV 2020년 9월 18일
편집: KSSV 2020년 9월 18일
A = [1 2 1 2 2 3 4 5] ;
T = A-A.' ;
x = 0 ;
idx = T == x ; % get logical indices
[r,c] = ind2sub(size(T),find(idx)) % get row and column positions

추가 답변 (1개)

madhan ravi
madhan ravi 2020년 9월 18일
[r, c] = find(T == myvalue)

카테고리

Help CenterFile Exchange에서 Task Control and Worker Communication에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by