From: Rohit on
Hi
I am new to matlab and it will be great if you could help me out with this very small problem.
I have an array of input, say, x of length 5 and other normal scalar inputs.
How to define x inside s function builder? Like for other inputs (scalar), i define it as
static real_T a,b; (if a & b are other inputs). I am even facing problem using a for loop inside s function builder and may be that is because, i m defning x in a wrong manner.
Please go through this small code and suggest me somethng:

static real_T Ra,Ro ;
static real_T *hrr,i ;

Ta = u[0];
To = u[1];
for(i=1;i<4;i++)
{
hrr[i] = u[1+i];
}

y[0] = hrr[2]*Ra*Ro;

Here, hrr is going as an array of input of length 3. Ra & Ro are other scalar inputs. Finally there is only one output (y[0])

The Errors i was getting while building the s functon builder
Error testing_wrapper.c: 58 operands of + have illegal types `pointer to double' and `double'
Error testing_wrapper.c: 58 type error: pointer expected
Error testing_wrapper.c: 58 operands of + have illegal types `pointer to const double' and `double'
Error testing_wrapper.c: 58 type error: pointer expected

Line 58 corresponds to static real_T *hrr,i ;
Its a very easy code. I just want to be familiar with s function builder. So please help me out.
Thanx
From: Rohit on
"Rohit " <mascot12(a)gmail.com> wrote in message <hejuif$mqe$1(a)fred.mathworks.com>...
> Hi
> I am new to matlab and it will be great if you could help me out with this very small problem.
> I have an array of input, say, x of length 5 and other normal scalar inputs.
> How to define x inside s function builder? Like for other inputs (scalar), i define it as
> static real_T a,b; (if a & b are other inputs). I am even facing problem using a for loop inside s function builder and may be that is because, i m defning x in a wrong manner.
> Please go through this small code and suggest me somethng:
>
> static real_T Ra,Ro ;
> static real_T *hrr,i ;
>
> Ra = u[0];
> Ro = u[1];
> for(i=1;i<4;i++)
> {
> hrr[i] = u[1+i];
> }
>
> y[0] = hrr[2]*Ra*Ro;
>
> Here, hrr is going as an array of input of length 3. Ra & Ro are other scalar inputs. Finally there is only one output (y[0])
>
> The Errors i was getting while building the s functon builder
> Error testing_wrapper.c: 58 operands of + have illegal types `pointer to double' and `double'
> Error testing_wrapper.c: 58 type error: pointer expected
> Error testing_wrapper.c: 58 operands of + have illegal types `pointer to const double' and `double'
> Error testing_wrapper.c: 58 type error: pointer expected
>
> Line 58 corresponds to static real_T *hrr,i ;
> Its a very easy code. I just want to be familiar with s function builder. So please help me out.
> Thanx
From: Rohit on
"Rohit " <mascot12(a)gmail.com> wrote in message <hejvij$ol6$1(a)fred.mathworks.com>...
> "Rohit " <mascot12(a)gmail.com> wrote in message <hejuif$mqe$1(a)fred.mathworks.com>...
> > Hi
> > I am new to matlab and it will be great if you could help me out with this very small problem.
> > I have an array of input, say, x of length 5 and other normal scalar inputs.
> > How to define x inside s function builder? Like for other inputs (scalar), i define it as
> > static real_T a,b; (if a & b are other inputs). I am even facing problem using a for loop inside s function builder and may be that is because, i m defning x in a wrong manner.
> > Please go through this small code and suggest me somethng:
> >
> > static real_T Ra,Ro ;
> > static real_T *hrr,i ;
> >
> > Ra = u[0];
> > Ro = u[1];
> > for(i=1;i<4;i++)
> > {
> > hrr[i] = u[1+i];
> > }
> >
> > y[0] = hrr[2]*Ra*Ro;
> >
> > Here, hrr is going as an array of input of length 3. Ra & Ro are other scalar inputs. Finally there is only one output (y[0])
> >
> > The Errors i was getting while building the s functon builder
> > Error testing_wrapper.c: 58 operands of + have illegal types `pointer to double' and `double'
> > Error testing_wrapper.c: 58 type error: pointer expected
> > Error testing_wrapper.c: 58 operands of + have illegal types `pointer to const double' and `double'
> > Error testing_wrapper.c: 58 type error: pointer expected
> >
> > Line 58 corresponds to static real_T *hrr,i ;
> > Its a very easy code. I just want to be familiar with s function builder. So please help me out.
> > Thanx

Please help me out with this problem. I need to work on a big code and without this basic knowledge i cannot proceed.