How can I plot a 12x12x12 matrix with a point in [1,1,1 ] , [1,1,2] , etc
1 view (last 30 days)
Show older comments
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
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.
Answers (1)
Benjamin Kraus
on 6 Dec 2017
I can interpret your question in two different ways.
For example:
M = zeros(12,12,12);
M(3,2,5) = 1;
isosurface(M, 0.5);
[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.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!