# Help with linear optimisation problem

조회 수: 1(최근 30일)
Teshan Rezel 2022년 1월 25일
댓글: Teshan Rezel 2022년 1월 31일
Hi folks,
I'm looking to conduct a linear optimisation and was hoping for some help on the matter.
I have 56 columns of data, with 256 rows each; lets call this set A. I have another column of data, with 56 rows; lets call this set B. I essentially want to correlate each of the 256 values in each column of set A to a single value in set B; lets call this set C.
I want to know which of the 256 values across set C give the best correlation between sets A and B. In other words, which row in set A gives the best correlation to the corresponding value in set B, across all columns of set A.
Any help on this matter would be most appreciated!

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

### 채택된 답변

Matt J 2022년 1월 25일
편집: Matt J 2022년 1월 25일
Diffs=abs(reshape(B,1,1,[])-A);
d=min(Diffs,[],3);
[Arows,Acols]=find(d==min(d(:)));
##### 댓글 수: 11표시숨기기 이전 댓글 수: 10
Teshan Rezel 2022년 1월 31일
@Matt J outstanding, thank you!

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

### 범주

Find more on Matrices and Arrays in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by