Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: build a matrix

$
0
0
A = [11 22 33; 44 55 66; 77 88 99];
B = [11 1 1; 22 1 2; 33 1 3; 44 2 1; 55 2 2; 66 2 3; 77 3 1; 88 3 2; 99 3 3];
[x, y] = ndgrid(1:length(A));
X = [reshape(A.', [], 1), y(:), x(:)];
isequal(X, B)

Viewing all articles
Browse latest Browse all 19628

Trending Articles