undisired grid size with meshgrid
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Yu Li
le 16 Jan 2018
Réponse apportée : Image Analyst
le 16 Jan 2018
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
0 commentaires
Réponse acceptée
Image Analyst
le 16 Jan 2018
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)
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!