Correcting the label in a 3D scatter plot
이전 댓글 표시
Hello there,
I have a .xls file that contains x,y,z vertics. The sequence goes something like this (that header of each): x0,y0,z0,x1,y2,z2,..........x1000,y1000,z1000. (3000points in total) Each x,y,z together forms a point I see in the scatter 3D point. I am wondering how to identity/access that particular point properly, say x0,y0,z0 will be verticx 0, x1000,y1000,z1000 will be verticx 1000.
That's what I have from the help eailer:
clc;clear all;
[num,txt,raw] = xlsread('test_april24.csv');
for i = 1:3:3000
a = num(3,i);
b = num(3,i+1);
c = num(3,i+2);
k=scatter3(a,b,c, 'filled');
S=string(1:3000).';
text(a, b, c, S);
row = dataTipTextRow('Index: ',i');
k.DataTipTemplate.DataTipRows(end+1) = row;
hold on
end
The index number is now just showing one of the axis (since its based on the total number i) say index 3000 but I am expecting 1000
In addition, when the index popped up, is there a way that I can access a participant point that I am interested? say x100,y100,z100 (verticx100)?
Many thanks!
댓글 수: 5
Image Analyst
2020년 4월 26일
You forgot to attach 'test_april24.csv'. Make it easy for us to help you.
darova
2020년 4월 26일
Can't run the script

steamrice
2020년 4월 26일
steamrice
2020년 4월 26일
steamrice
2020년 4월 26일
채택된 답변
추가 답변 (1개)
Image Analyst
2020년 4월 27일
If you want vertex 100, just use that index to get the x, y, and z values:
x100 = x(100);
y100 = y(100);
z100 = z(100);
댓글 수: 7
steamrice
2020년 4월 27일
Image Analyst
2020년 4월 27일
Not sure what that means. There is no row zero or index zero in a matrix. In MATLAB all matrices start with row 1 and column 1. So I assume x0,y0,z0 are all in index 1, so what's wrong with saying
x0 = x(1);
y0 = y(1);
z0 = z(1);
steamrice
2020년 4월 27일
Image Analyst
2020년 4월 27일
Still not sure what you mean. MATLAB uses 1-based arays, not 0-based arrays like C++. See the FAQ: FAQ #22 Subscript_indices_must_either_be_real_positive_integers_or_logicals
steamrice
2020년 4월 27일
steamrice
2020년 4월 27일
Image Analyst
2020년 4월 27일
No, but it looks like darova figured out what you want and solved it because you accepted his/her answer.
카테고리
도움말 센터 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



