MATLAB: For loop for 15×2045 matrix

fft

I am trying to run fft function for every row of 15×2045 matrix. 13 out of 15 rows have NaN as the last element (2045th element) How I can do it? so far I have tried this:
for k = 1:length(Final) %Final is 15x2045 matrix (I have converted a cell to this matrix)
HH = fft(Final{k},NFFT)/L;
power=(2*abs(HH(1:NFFT/2+1)));
end
%error I get is:Cell contents reference from a non-cell array object.
I appreciate any help, Thanks!

Best Answer

for k = 1 : size(Final,1) %Final is 15x2045 matrix (I have converted a cell to this matrix)
HH(k,:) = fft(Final(k,:),NFFT)/L;
Fpower(k,:) = (2*abs(HH(k,1:NFFT/2+1)));
end
I renamed power to Fpower to avoid interfering with the MATLAB function named power (which is more commonly known as the .^ operator)
Note: you do not need to do this column by column. You can vectorize it as
HH = fft(Final, NFFT, 2)./L;
Fpower = 2 * abs(HH(:,1:NFFT/2+1));