The returned arc_diameters from the strand2casx function can contain NaN values when the arc radius index for both the endpoints of an arc happen to be the highest index in the range of arc radius indices. In this situation, the computed arc radius for the arc can be slightly above the last index due to numerical error. Then in interpolating the radius index to a length, the interp1 function returns NaN values for these radii because they are outside the interpolation bounds and no extrapolation method has been defined.
Proposed solution is enable extrapolation in line 93:
arc_radii = exp( interp1( 1 : length( lumen_radius_in_microns_range ), log( lumen_radius_in_microns_range ), arc_radius_indices, 'linear', 'extrap' ));
This will eliminate the current source of NaN values, and small extrapolation outside of the radius index range should not produce inaccurate values for the arc radius.