fi object in indexing
이전 댓글 표시
hi guys, i have got following code snippet: for n = 1:30 s(n+1)= x1f(n+m0f) end
Here m0f is a fi object. While trying to run this i get error message as: Function 'subsindex' is not defined for values of class 'embedded.fi'. how can i extract the numerical value of m0f and use it or is there any other way?
thanks for your time and effort, Binayak.
답변 (1개)
Walter Roberson
2011년 3월 8일
m0f is an fi object, but x1f is an array, right? You will need to convert the value n+m0f into a value that can be used as an index, such as via double(n+m0f)
Is there a reason you are not using
s(2:31) = x1f(double(m0f)+(1:30))
Or have I read incorrect and x1f is in fact a function that is not vectorized ? If x1f is a function, then I would not expect the problem to show up against the code line you show: I would expect it to instead show up against some code line in x1f.
댓글 수: 2
Binayak
2011년 3월 8일
Walter Roberson
2011년 3월 8일
Convert the numbers to one of the integer data types such as uint16 or uint32. It doesn't have to be double: you just cannot index by a fixed point number.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!