MATLAB: Finding integers in an array.

integersnan

Hey Guys,
I have an column matrix that basically consists of NaNs and some integers in between them. Are there any functions in MATLAB that will help me find 1. the first integer value in the array, 2. its location 3. store the value
Thanks, NS

Best Answer

V = [nan;nan;9;nan;6;7;nan;9] % An example to work with...
idx = find(V==V,1); % Location. nan never equals nan...
val = V(idx); % Value at Location.