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.

Answers (1)

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
Binayak on 8 Mar 2011
thanks walter.
x1f is an array containing numbers in fixed point format (created using fi). The issue is I am writing this code for fixed point dsp implementation and will convert it to C using emlmex and emlc functions. I hence don't want to use the double type which is a floating point format.
Any suggestions?
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.

Sign in to comment.

Tags

Asked:

on 8 Mar 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!