I made this code;
x = [0 1]'; y = [0 1]'; m = 2; n = 1;cell = {x, x, y}; % 2 x and 1 y
[a_1 a_2 b_1] = ndgrid(cell{:});a_1 = a_1(:); a_2 = a_2(:);b_1 = b_1(:);
But if I generalise this, by assigning x, y, m, n,
How can I make … parts?
cell = {x, ... , x, y, ... , y}; % m Xs and n Ys[a_1 a_2 ... a_m b_1 ... b_n] = ndgrid(cell{:});a_1 = a_1(:); ... a_m = a_m(:);b_1 = b_1(:); ... b_n = b_n(:);
Thanks to all!
Best Answer