Ararat - don't use the elseif and just use two if statements (since you want to apply a specific action to both variables)
if any(isnan(enthleft), 'all');
enthleft = 0;
if any(isnan(enthright), 'all');
enthright = 0;
By the way, your above code will set all elements of the enthleft or enthright arrays to zero if at least one element is NaN. Is this the intended behaviour?