Plot a grid(multiple) cube using the plotcube function
9 次查看(过去 30 天)
显示 更早的评论
I am trying to plot many cubes using the plotcube function without using a for loop. Here's my code...
x = 0:1:1;
y = 0:1:1;
z = 0:1:1;
[X1,Y1,Z1]=meshgrid(x,y,z);
[X2,Y2,Z2]=meshgrid(x,y,z);
[X3,Y3,Z3]=meshgrid(x,y,z);
X1=permute(X1,[2 1 3]); Y1 = permute(Y1,[2 1 3]); Z1= permute(Z1,[2 1 3]);
X1(end+1,:,:)=NaN;Y1(end+1,:,:)=NaN;Z1(end+1,:,:)=NaN;
plotcube([1 1 1],[X1(1,3) Y1(1,3) Z1(1,3)],.2,[0 0 0])
But it only plots one cube.
Something like this...
0 个评论
回答(1 个)
Ankriti Sachan
2020-10-28
Hi,
The image shared by you seems to comprise numerous small cubes of unit edge-length combined to form a large cube.
Based on the syntax of 'plotcube' mentioned on this page - https://www.mathworks.com/matlabcentral/fileexchange/15161-plotcube, you can see that the second parameter is the 'Origin.' From the image displayed above, I believe that passing the array to the 'Origin' parameter, resulted in many cubes, each with a different origin. But, these are just my interpretations. You can contact the owner of this file exchange submission, mentioned in the above link, to get more clarity on how it is implemented.
You can also try plotting one small cube at a time and check if it is displayed as expected in terms of origin, dimension, etc.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!