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
Walter Roberson 2011년 3월 8일

0 개 추천

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
Binayak 2011년 3월 8일
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?
Walter Roberson
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에 대해 자세히 알아보기

태그

질문:

2011년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by