How to replace the array elements with "Nan" or "Inf" to either zero or some other number?
Show older comments
AdjSpeed, THR, Thrtbl, AdjIndTorque are the different fields of data going in to the calculation, all the fields return the values except the two values in AdjIndTorque which are returning "Nan" (PFA Excel, line 2456 and 2457). [e,f] = size(AdjSpeed) i=1; while i<(e+1) k=interp2(IT(1,:),THR,ThrTbl,AdjSpeed(i,1),THR); if (isnan(AdjIndTorque(i,1))) AdjIndTorque(i,1) = 0; end yout2(i,1)=interp1(k,THR,AdjIndTorque(i,1)); i=i+1; end
Console O/P:
Error using griddedInterpolant, The coordinates of the input points must be finite values; Inf and NaN are not permitted.
Error in FTCC>pushbutton3_Callback (line 439) yout2(i,1)=interp1(k,THR,AdjIndTorque(i,1));
I tries some thing with 'isnan' but its not doing anything
Accepted Answer
More Answers (0)
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!