Why do I get unexpected errors when using NaN values in INTERP1?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Why do I get unexpected errors when using NaN values in INTERP1?
Using the INTERP1 function of MATLAB 6.1 (R12.1) with NaN values returns an unusual error:
interp1([NaN 1:4],[2:6],3.5)
??? Index into matrix is negative or zero. See release notes on changes to
logical indices.
Error in ==> D:\Applications\MATLAB\toolbox\matlab\polyfun\interp1.m
On line 157 ==> s = u - x(k);
This error can be traced to the results of the HISTC function called earlier within INTERP1:
[n,k] = histc(3.5,[NaN 1:4])
n =
0 0 0 0 0
k =
0
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
INTERP1 is not intended to handle NaN's as input, since NaN values cannot be placed in increasing order (a requirement of INTERP1 and of HISTC). As a workaround, use Inf or -Inf to represent a limit.
Our development staff has been notified and is currently looking into addressing this problem in a future release of MATLAB.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!