MATLAB: Finding the position of a cell within a Matrix

matrixstring

Hello Fellow Developer,
i have been given a 100×13 Matrix with Integers in it. But in one cell there is NaN written in it.
I know that the cell with NaN is in column two, so I tried the following code: But my Variable k never changes to one.
for i=1:100
if Matrix(i, 2) == 'NaN'
k = 1
end
end

Best Answer

Read about isnan.
idx = isnan(Matrix(:,2)) ;
Matrix(idx,:)
% To get the rows
rows = find(idx)