I have a matrix 16561 x 3. Each row represents a point (x,y,m), and I wanna have a new array or matrix or something that gives me every possible combination of 3 points, So every possible combination of 3 rows (not adding them together).

조회 수: 1 (최근 30일)
h = getHeight;
HR=reshape(h,[65341,1])
%turning the h variable into an array [65341 x 1]
x = getX;
XR=reshape(x,[65341,1]);
%turning the x variable into an array [65341 x 1]
y = getY;
YR=reshape(y,[65341,1]);
%turning the y variable into an array [65341 x 1]
FA = [XR YR HR];
%FA stands for Final Array. combines the three variables into one array
indeces=find(FA(:,3)==0);
FA(indeces,:) = [];
%this gets rid of any rows with a 0 in the HR variable.
%now I want every combination of three rows possible from the final array. I don't know how you would represent that.
Also, what would be the best way to reduce the size of the matrix?
  댓글 수: 4
Image Analyst
Image Analyst 2018년 12월 19일
편집: Image Analyst 2018년 12월 19일
Area any of the 16,561 values the same? How many unique values are there in those 16,561 numbers? If it's only ten or a hundred or so, it's really easy. If each value is unique, then that's too many values like you and Dave said. You could try to subsample the unique values to get a more manageable number.
KSSV
KSSV 2018년 12월 19일
What is the prupose to have every three possible combinations? Are you planning to draw a surface or something? There might be more elegant solution for your problem, if you could tell your purpose.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by