From: Marcu on
Hi

I have the following code in a 'Embedded MATLAB Function':

kk = 1 ;
while ~(I(kk)<=Ns && I(kk+1)>Ns)
kk = kk+1 ;
end

kaI = [I(kk+1:Nsr) I(1:kk)] ;
last_stator = I(kk) ;


this: (kk+1:Nsr) - gives this error:

Size of index expression is not statically known.

Function 'Embedded MATLAB Function' (#78.3740.3748), line 118, column 10:
"kk+1:Nsr"

How can i workaround this?

thanx in advance
From: Ashish Uthama on
On Fri, 23 Apr 2010 10:50:22 -0300, Marcu <marcufmarius(a)yahoo.com> wrote:

> Hi
>
> I have the following code in a 'Embedded MATLAB Function':
>
> kk = 1 ;
> while ~(I(kk)<=Ns && I(kk+1)>Ns)
> kk = kk+1 ;
> end
>
> kaI = [I(kk+1:Nsr) I(1:kk)] ;
> last_stator = I(kk) ;
>
>
> this: (kk+1:Nsr) - gives this error:
>
> Size of index expression is not statically known.
>
> Function 'Embedded MATLAB Function' (#78.3740.3748), line 118, column 10:
> "kk+1:Nsr"
>
> How can i workaround this?
>
> thanx in advance

My understanding is: size of kaI cannot be determined during compilation
process. The posted code segment indicates that it might vary depending on
the while loop. This is probably how Embedded MATLAB is designed (no
dynamic allocation).

Without more knowledge, I would suggest using your knowledge of the range
of potential values for kk and initializing kaI to the 'worst case' size.