필터 지우기
필터 지우기

Plot a grid(multiple) cube using the plotcube function

조회 수: 7 (최근 30일)
Bryant Harris
Bryant Harris 2020년 10월 23일
답변: Ankriti Sachan 2020년 10월 28일
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...

답변 (1개)

Ankriti Sachan
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.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by