error using interp1 !!
3 次查看(过去 30 天)
显示 更早的评论
Hello! I wanted to interpolate the NaN values within a matrix , and it works perfectly but I wanted also to interpolate the Inf entries so I have used the following line:
MyMatrix(isinf(MyMatrix))=NaN;
but then I get the following error :
Index exceeds matrix dimensions.
Error in interp1 (line 128)
extptids = Xq < X(1) | Xq > X(end);
could you give me any hints to what is causing this error and how can I interpolate the Inf entries without any errors . thank you ! Best regards!
3 个评论
回答(1 个)
M
2017-10-31
编辑:M
2017-10-31
Maybe the problem comes from the fact that
colInd(IndnNAN(r,:))
ans =
1×0 empty double row vector
and so is MyMatrix(r,IndnNAN(r,:))
3 个评论
M
2017-10-31
Well, given your definition, either you have :
IndnNAN(r,:)
ans =
1×10 logical array
1 1 1 1 1 1 1 1 1 1
or
IndnNAN(r,:)
ans =
1×10 logical array
0 0 0 0 0 0 0 0 0 0
so colInd(IndnNAN(r,:)) will either be equal to 1: colN or it will be empty.
The question is, what did you want to do ?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!