Coordinates of each rectangular cell is required
3 ビュー (過去 30 日間)
古いコメントを表示
I have created a mesh using mesh command having 16 cells.
I want the coordinates of every cell in a separate array.I had tried the following code but it didnot work.Please help.
x=zeros(1,5)+5;
y=linspace(4,16,5);
xx=x';
yy=y';
[XX,YY]=meshgrid(xx,y);
Y=YY';
z=linspace(-1,3,5)';
zz=repmat(z,1,5);
A=mesh(XX,Y,zz);
axis([-10 40 -10 40])
for a=1:4
for b=1:4
C1X1(a,b)=[XX(a,b) XX(a,b+1) XX(a+1,b) XX(a+1,b+1)];
end
end
C1X1 should be 16 by 4 matrix as the loop runs 16 times but I am unable to define C1X1
0 件のコメント
採用された回答
Dyuman Joshi
2021 年 11 月 29 日
You are defining C1X1 incorrectly (trying to fit 4 elements as 1) -
x=zeros(1,5)+5;
y=linspace(4,16,5);
xx=x';
yy=y';
[XX,YY]=meshgrid(xx,y);
Y=YY';
z=linspace(-1,3,5)';
zz=repmat(z,1,5);
A=mesh(XX,Y,zz);
axis([-10 40 -10 40])
C1X1=[];
for a=1:4
for b=1:4
C1X1=[C1X1; XX(a,b) XX(a,b+1) XX(a+1,b) XX(a+1,b+1)];
end
end
C1X1
5 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Inertias and Loads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!