Ho do I make a matrix with point data?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I currently have data for 3d points and want to make a matrix out of them
This point data is structured as 3 matrices each containing x, y, z locations which look like these
x=[-3.266573190689087, -3.266134023666382, -3.266134023666382, -3.266573190689087, ... ]
y=[-0.372330516576767, -0.372330516576767, -0.371891230344772, -0.371451914310455, ... ]
z=[-0.085013940930367, -0.085015110671520, -0.084998413920403, -0.085046470165253, ... ]
My hope is to find a way to combine these three matrices into one matrix which would be
matrix( y(i) , x(i) ) = z(i)
x,y,z are all 168136818 long so I dont thick I can share them due to their size
Is there a way to do this in matlab?
thank you for your help.
채택된 답변
KSSV
2020년 9월 13일
Let A be your m*3 data matrix.
x = A(:,1) ; y = A(:,2) ; z = A(:,3) ;
%%structured
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
%%unstructured
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
figure
trisurf(tri,x,y,z)
댓글 수: 14
Hoyong Yie
2020년 9월 13일
Thank you very much,
But I am getting an error during reshape part
[Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate
size for that dimension.]
I looked through the reshape function but can't find what might cause this problem.
Can you help me?
KSSV
2020년 9월 13일
Your data is scattered or structured?
Hoyong Yie
2020년 9월 13일
If structured means the matrix is full, I think it's mostly structured, where the end parts have some holes
KSSV
2020년 9월 13일
Attach your data.
Hoyong Yie
2020년 9월 13일
This would be the A part of my data
KSSV
2020년 9월 13일
There is no data in .mat file. It shows 0kb.
Hoyong Yie
2020년 9월 13일
I think it was because the size was over 400MB
would sharing like this be ok?
KSSV
2020년 9월 13일
You have to give permission to access...
Hoyong Yie
2020년 9월 13일
Done. Sorry for the inconvenience. I never shared a file like this before.
x = A(:,1) ;
y = A(:,2) ;
z = A(:,3) ;
% Use grid data to get matrices
dx = 0.05 ; dy = 0.05 ; % specify your resolution
xi = min(x):dx:max(x) ;
yi = min(y):dy:max(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
pcolor(X,Y,Z)
shading interp
colorbar
Hoyong Yie
2020년 9월 14일
thank you very much,
but can you tell me what does idx means?
KSSV
2020년 9월 14일
You can remove the idx. I forgot to remove it while answering. I worked with reduced data as data was huge, so I have used idx and indices to pick some part of data.
Hoyong Yie
2020년 9월 14일
Ok thank you.
I'm quite new to matlab and was stuck with this for 2 weeks.
Your help is greatly appreciated.
KSSV
2020년 9월 14일
You are welcome...my pleasure helping you. :)
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
