MATLAB: I am trying to add row to image matrix.

add row to image matrix.

img=imread('frame1.jpg');
>> size(img)
ans = 720 1280 3
nimg=img;
X=zeros(1,720);
nimg=img;
>> nimg=[img;X];
Error:
Error using vertcat
Dimensions of matrices being concatenated are not consistent.

Best Answer

X=zeros(1,1280,3); %you forgot to add 1279 columns instead you just added 1 column which caused the error , 3 indicates its 3D
nimg=[nimg; X]; %added to each page (because nimg is 3D matrix)
command window:
>> size(nimg)
ans =
721 1280 3