How can I plot a 12x12x12 matrix with a point in [1,1,1 ] , [1,1,2] , etc

1 view (last 30 days)
I am struggling between the scatter3, the plot3 and the meshgrid so any income provided will be awesome
I would like to plot a 12x12x12 matrix with a single point/dot in ALL the coordinates. As a meshgrid but in 3D..
Any ideas?
  1 Comment
Jan
Jan on 6 Dec 2017
Does "a 3 dimension 12 size matrix" mean a [3 x 12] matrix? "12x12x12 matrix" is something else. Please explain again (by editing the question, not in a comment), what your inputs are.

Sign in to comment.

Answers (1)

Benjamin Kraus
Benjamin Kraus on 6 Dec 2017
I can interpret your question in two different ways.
The first way, I think the command you are looking for is isosurface.
For example:
M = zeros(12,12,12);
M(3,2,5) = 1;
isosurface(M, 0.5);
The second way, I think you want meshgrid and plot3:
[X,Y,Z] = meshgrid(1:12);
plot3(X(:),Y(:),Z(:),'.');
Note: I am combining two steps here:
X = X(:);
Y = Y(:);
Z = Z(:);
This converts the matrices into column vectors instead of matrices, as plot3 does not accept 3D matrices.

Community Treasure Hunt

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

Start Hunting!