Filter löschen
Filter löschen

Label each data points?

9 Ansichten (letzte 30 Tage)
steamrice
steamrice am 12 Mär. 2020
Kommentiert: Walter Roberson am 29 Apr. 2020
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 (1000data points for each x,y,z). I am wondering is it possible to use scratter3 to plot the points with its label (x0,y0,z0,x1,y2,z2,..........x1000,y1000,z1000) so I can identity/access that particular point?
Many thanks!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Mär. 2020
scatter3 cannot do labels.
You can text() and pass it vectors of x y z and a cell array of character vectors that are corresponding labels or a string array. For example string(1:1000).'
  37 Kommentare
steamrice
steamrice am 14 Mär. 2020
I commented the for loop I had
Walter Roberson
Walter Roberson am 14 Mär. 2020
I would recommend starting by removing the
clc;clear all; close all

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

steamrice
steamrice am 15 Mär. 2020
Sorry for the late reply! I tried that and still got the same result..
  3 Kommentare
steamrice
steamrice am 26 Apr. 2020
Sorry for left you hanged. I was working on the other project. The below code from you suggested eailer work!
clc;clear all;
[num,txt,raw] = xlsread('test_april24.csv'); %change the excel file name when received the new one
for i = 2:3:3002-2
a = num(3,i);
b = num(3,i+1);
c = num(3,i+2);
k=scatter3(a,b,c, 'filled');
S=string(1:3662).';
text(a, b, c, S);
row = dataTipTextRow('Index: ',i');
k.DataTipTemplate.DataTipRows(end+1) = row;
hold on
end
The label also showing the the point. However, if I can ask one more question, from what I understand, the 3D plot I am seeing and each point is coming from each x,y,z (x1,y1,z1 forms a point). And the label is showing the total point 3002. Is there a way to group the index point? (x1,y1,z1 would label as index 1and x3000,y3000,z3000 would label as 1500)?
I have been trying to modifiy this line,
row = dataTipTextRow('Index: ',i');
to somthing like
index=1:1500
row = dataTipTextRow('Index: ',index');
But it would only shows index as all 1 (i think it did not work if I do that inside the for loop..)
Sorry my thought process is a bit messy..
Walter Roberson
Walter Roberson am 29 Apr. 2020
row = dataTipTextRow('Index: ',i/2);
perhaps?

Melden Sie sich an, um zu kommentieren.

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by