MATLAB: Warning: Integer operands are required for colon operator when used as index

warning

I am using fft functions and have twice in my code this warning message, bu no clue why I get the warning:
N = 2048*16;
sizeData = size(data,2);
padding = (N-sizeData)/2;
cInput = zeros([1 N]); % <-- Warning

cInput(padding+1:(padding+sizeData)) = data;
cInput = fftshift(cInput);
% transform
cfourier = fftshift(fft(cInput));
% iFFt
cOutput = ifft(ifftshift(cfourier));
cOutput = ifftshift(cOutput); % <-- Warning
AmpIFourier = abs(cOutput(padding+1:(padding+sizeData)));

Best Answer

(N-sizeData)/2 can be a fractional number, e.g. "something point 5" so try
padding = floor((N-sizeData)/2);
or better yet, just use the padarray() function to do your padding.
Related Question