フィルターのクリア

undisired grid size with meshgrid

5 ビュー (過去 30 日間)
Yu Li
Yu Li 2018 年 1 月 16 日
回答済み: Image Analyst 2018 年 1 月 16 日
Hi: I have a three 1-D constant space matrix, and I want to use them to generate a 3D space mesh.
the size of each is x: 1*532, y: 1*357, z:1*1072.
after I used the meshgrid:
[X,Y,Z]=meshgrid(x,y,z);
the size of X, Y, Z are : 357*532*1072. but I think they should be: 532*357*1072.
is there any problem with my operation?
Thanks! Li

採用された回答

Image Analyst
Image Analyst 2018 年 1 月 16 日
Remember y is rows and thus will be the first index. So it returns an array 357*532*1072 which is 357 rows by 532 columns by 1072 slices. Your y is 357 so that's why it's first and you have 357 rows. When the workspace says n*m*s, the first number is the number of rows, which is y, not x.
x = 1:532; % Columns
y = 1 : 357; % Rows
z = 1 : 1072; % Slices
[X,Y,Z]=meshgrid(x, y, z);
[rows, columns, slices] = size(X)

その他の回答 (1 件)

Matt J
Matt J 2018 年 1 月 16 日
Use ndgrid instead
[X,Y,Z]=ndgrid(x,y,z);

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by