Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to label 3d data?

Subject: How to label 3d data?

From: Hassan

Date: 29 Jul, 2009 16:39:02

Message: 1 of 2

Hello everybody,
Please consider matrix
X = [ 0 1 1 3; 0 2 2 5; 0 1 2 3 ]
I plot these points by:
plot3(X(1,:), X(2,:), X(3,:), 'ok')
I desire to give a label for each 3D point. For example ‘1’ to point (0 0 0); and ‘2’ to point (1 2 1) and so on. I write:
for i=1:4
       text (X(1,:), X(2,:), X(3,:),[ ' ',int2str(i)]);
end
 
But it doesn’t work. I appreciate if somebody can help me.
Thanks to all.

Subject: How to label 3d data?

From: Dave Brackett

Date: 29 Jul, 2009 21:54:02

Message: 2 of 2

"Hassan " <h_radvar@yahoo.com> wrote in message <h4ptv6$87$1@fred.mathworks.com>...
> Hello everybody,
> Please consider matrix
> X = [ 0 1 1 3; 0 2 2 5; 0 1 2 3 ]
> I plot these points by:
> plot3(X(1,:), X(2,:), X(3,:), 'ok')
> I desire to give a label for each 3D point. For example ‘1’ to point (0 0 0); and ‘2’ to point (1 2 1) and so on. I write:
> for i=1:4
> text (X(1,:), X(2,:), X(3,:),[ ' ',int2str(i)]);
> end
>
> But it doesn’t work. I appreciate if somebody can help me.
> Thanks to all.

You are giving 4 coordinates for each text function so it is plotting each ID at each point. Replace the colon in the text function inputs with the index i like this:
text (X(1,i), X(2,i), X(3,i),[ ' ',int2str(i)]);

Hope that helps

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us