fi object in indexing
Show older comments
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.
Answers (1)
Walter Roberson
on 8 Mar 2011
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 Comments
Binayak
on 8 Mar 2011
Walter Roberson
on 8 Mar 2011
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.
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!