From: Carlos Ferreira on
Hi!
I'm having a problem when using the Attribute Function in SimEvents. I want trough code, to create a new entity attribute, with a specific vector size, but i am unable to make it work with the block Get Attribute.

the structure is something like this:

Attribute Function -> Get Attributes (Data, SizeOfData) -> Stateflow Chart

The Data attribute should be a vector with 1500 of size, so that the Stateflow Chart can use it, but when i compile my project, the Get Attribute block complains about the incompatibilities of signals (Get Attributes Data output is a scaler when Chart Data input is a 1500 size vector).

I backtracked the problem to the Attribute Function, so that if i trough code say:
out_data = [1 2 3 4 5], the Get Attribute Data output will be a 1x5 signal, but i don't want to write a vector with 1500 by hand....

Can anyone help me with this... it's getting frustrating..
From: Devdatt Lad on
Hi Carlos,

If you just want to *create* an attribute on the passing entity, then in the
Attribute Function block code you can simply do:

out_Data = 1:1500;
OR
out_Data = zeros(1,1500);

Does this work?

--
Devdatt Lad
The MathWorks, Inc.


"Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message
news:i2kfuj$4be$1(a)fred.mathworks.com...
> Hi!
> I'm having a problem when using the Attribute Function in SimEvents. I
> want trough code, to create a new entity attribute, with a specific vector
> size, but i am unable to make it work with the block Get Attribute.
>
> the structure is something like this:
>
> Attribute Function -> Get Attributes (Data, SizeOfData) -> Stateflow Chart
>
> The Data attribute should be a vector with 1500 of size, so that the
> Stateflow Chart can use it, but when i compile my project, the Get
> Attribute block complains about the incompatibilities of signals (Get
> Attributes Data output is a scaler when Chart Data input is a 1500 size
> vector).
>
> I backtracked the problem to the Attribute Function, so that if i trough
> code say:
> out_data = [1 2 3 4 5], the Get Attribute Data output will be a 1x5
> signal, but i don't want to write a vector with 1500 by hand....
>
> Can anyone help me with this... it's getting frustrating..


From: Devdatt Lad on
I should also mention that you can use the Set Attribute block from the
SimEvents Attributes library also to simply create an attribute.

--
Devdatt Lad
The MathWorks, Inc.


"Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message
news:i2mpug$gn1$1(a)fred.mathworks.com...
> Hi Carlos,
>
> If you just want to *create* an attribute on the passing entity, then in
> the Attribute Function block code you can simply do:
>
> out_Data = 1:1500;
> OR
> out_Data = zeros(1,1500);
>
> Does this work?
>
> --
> Devdatt Lad
> The MathWorks, Inc.
>
>
> "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message
> news:i2kfuj$4be$1(a)fred.mathworks.com...
>> Hi!
>> I'm having a problem when using the Attribute Function in SimEvents. I
>> want trough code, to create a new entity attribute, with a specific
>> vector size, but i am unable to make it work with the block Get
>> Attribute.
>>
>> the structure is something like this:
>>
>> Attribute Function -> Get Attributes (Data, SizeOfData) -> Stateflow
>> Chart
>>
>> The Data attribute should be a vector with 1500 of size, so that the
>> Stateflow Chart can use it, but when i compile my project, the Get
>> Attribute block complains about the incompatibilities of signals (Get
>> Attributes Data output is a scaler when Chart Data input is a 1500 size
>> vector).
>>
>> I backtracked the problem to the Attribute Function, so that if i trough
>> code say:
>> out_data = [1 2 3 4 5], the Get Attribute Data output will be a 1x5
>> signal, but i don't want to write a vector with 1500 by hand....
>>
>> Can anyone help me with this... it's getting frustrating..
>
>


From: Carlos Ferreira on
Thanks for your help! :)
Unfortunately it doesn't work.. i already tried that :S

The error i get is still the same :S

"Stateflow Interface Error: Port width mismatch. Input "PacketData_IN"(#44) expects a one dimensional vector with 1500 elements. The signal is a scalar."

The Get Attribute block, still thinks that the message attribute Data is a scaler :S I think this is an Embedded Matlab file compilation problem...

"Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message <i2mpug$gn1$1(a)fred.mathworks.com>...
> Hi Carlos,
>
> If you just want to *create* an attribute on the passing entity, then in the
> Attribute Function block code you can simply do:
>
> out_Data = 1:1500;
> OR
> out_Data = zeros(1,1500);
>
> Does this work?
>
> --
> Devdatt Lad
> The MathWorks, Inc.
>
>
> "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message
> news:i2kfuj$4be$1(a)fred.mathworks.com...
> > Hi!
> > I'm having a problem when using the Attribute Function in SimEvents. I
> > want trough code, to create a new entity attribute, with a specific vector
> > size, but i am unable to make it work with the block Get Attribute.
> >
> > the structure is something like this:
> >
> > Attribute Function -> Get Attributes (Data, SizeOfData) -> Stateflow Chart
> >
> > The Data attribute should be a vector with 1500 of size, so that the
> > Stateflow Chart can use it, but when i compile my project, the Get
> > Attribute block complains about the incompatibilities of signals (Get
> > Attributes Data output is a scaler when Chart Data input is a 1500 size
> > vector).
> >
> > I backtracked the problem to the Attribute Function, so that if i trough
> > code say:
> > out_data = [1 2 3 4 5], the Get Attribute Data output will be a 1x5
> > signal, but i don't want to write a vector with 1500 by hand....
> >
> > Can anyone help me with this... it's getting frustrating..
>
From: Carlos Ferreira on
Thanks for your help! :)
Unfortunately it doesn't work, i already tried that.. both 1:1500, zeros(1,1500) and the set attribute (with the previous expressions) :S no go...

I still get the same error...

"Stateflow Interface Error: Port width mismatch. Input "PacketData_IN"(#44) expects a one dimensional vector with 1500 elements. The signal is a scalar."

It seems this is a problem with the embedded matlab file compilation order, since the Get Attribute block, doesn't realize it should output a vector with a size of 1500... i really don't know how to solve this...

"Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message <i2mri0$39c$1(a)fred.mathworks.com>...
> I should also mention that you can use the Set Attribute block from the
> SimEvents Attributes library also to simply create an attribute.
>
> --
> Devdatt Lad
> The MathWorks, Inc.
>
>
> "Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message
> news:i2mpug$gn1$1(a)fred.mathworks.com...
> > Hi Carlos,
> >
> > If you just want to *create* an attribute on the passing entity, then in
> > the Attribute Function block code you can simply do:
> >
> > out_Data = 1:1500;
> > OR
> > out_Data = zeros(1,1500);
> >
> > Does this work?
> >
> > --
> > Devdatt Lad
> > The MathWorks, Inc.
> >
> >
> > "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message
> > news:i2kfuj$4be$1(a)fred.mathworks.com...
> >> Hi!
> >> I'm having a problem when using the Attribute Function in SimEvents. I
> >> want trough code, to create a new entity attribute, with a specific
> >> vector size, but i am unable to make it work with the block Get
> >> Attribute.
> >>
> >> the structure is something like this:
> >>
> >> Attribute Function -> Get Attributes (Data, SizeOfData) -> Stateflow
> >> Chart
> >>
> >> The Data attribute should be a vector with 1500 of size, so that the
> >> Stateflow Chart can use it, but when i compile my project, the Get
> >> Attribute block complains about the incompatibilities of signals (Get
> >> Attributes Data output is a scaler when Chart Data input is a 1500 size
> >> vector).
> >>
> >> I backtracked the problem to the Attribute Function, so that if i trough
> >> code say:
> >> out_data = [1 2 3 4 5], the Get Attribute Data output will be a 1x5
> >> signal, but i don't want to write a vector with 1500 by hand....
> >>
> >> Can anyone help me with this... it's getting frustrating..
> >
> >
>
 |  Next  |  Last
Pages: 1 2
Prev: 3D-FDTD
Next: MS VC++ Runtime error when start MATLAB!!