1

a = ones(2,2,2)

a(:,:,1) =

 1     1
 1     1

a(:,:,2) =

 1     1
 1     1

I want to append ones(1,1) to the bottom row of each of a(:,:,1) and a(:,:,2)

4

1 回答 1

2

It's easy to do with CAT function:

 a = cat(1, a, ones(1,2,2));

or VERTCAT:

a = vertcat(a, ones(1,2,2));
于 2013-04-01T21:03:01.187 回答