Prev: 3D-FDTD
Next: MS VC++ Runtime error when start MATLAB!!
From: Devdatt Lad on 27 Jul 2010 11:11 The statement: out_Data = 1:1500; is case-sensitive. I hope you tried it with exact case matching. Secondly, check that none of your blocks are attempting to use variable-sized signals, since SimEvents doesn't support them. Can you create a simple version of your model that reproduces this issue and file a Tech Support request with it? http://www.mathworks.com/support/contact_us/index.html Thanks! -- Devdatt Lad The MathWorks, Inc. "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message news:i2ms64$eln$1(a)fred.mathworks.com... > 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.. >> > >> > >>
From: Carlos Ferreira on 28 Jul 2010 06:56 I really don't know how to wrap the model up, due to dependencies :S But it's actually very simple.. Entity generator -> Attribute Function -> Entity to Function Call event -> Get Attributes output (Data, SizeOfData) -> (Data, SizeOfData) input to StateFlow Data Signal input to stateflow is a fixed-size real with 1500 of size (defined within the Stateflow). This is were the problems start... "Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message <i2msvc$7sp$1(a)fred.mathworks.com>... > The statement: out_Data = 1:1500; is case-sensitive. I hope you tried it > with exact case matching. Secondly, check that none of your blocks are > attempting to use variable-sized signals, since SimEvents doesn't support > them. > > Can you create a simple version of your model that reproduces this issue and > file a Tech Support request with it? > > http://www.mathworks.com/support/contact_us/index.html > > Thanks! > > -- > Devdatt Lad > The MathWorks, Inc. > > > "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message > news:i2ms64$eln$1(a)fred.mathworks.com... > > 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.. > >> > > >> > > >> >
From: Devdatt Lad on 28 Jul 2010 09:04 This model works for me. Contents of Attribute Function block: function [out_Data, out_SizeOfData] = fcn() out_Data = 1:1500; out_SizeOfData = 1500; Contents of Get Attribute: Row 1: Data Row 2: SizeOfData Stateflow chart: "Data" is Input from Simulink with Size: 1500 "SizeOfData" is Input from Simulink with Size: -1 -- Devdatt Lad The MathWorks, Inc. "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message news:i2p2c4$rit$1(a)fred.mathworks.com... >I really don't know how to wrap the model up, due to dependencies :S > But it's actually very simple.. > > Entity generator -> Attribute Function -> Entity to Function Call event -> > Get Attributes output (Data, SizeOfData) -> (Data, SizeOfData) input to > StateFlow > > Data Signal input to stateflow is a fixed-size real with 1500 of size > (defined within the Stateflow). > > This is were the problems start... > > > "Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message > <i2msvc$7sp$1(a)fred.mathworks.com>... >> The statement: out_Data = 1:1500; is case-sensitive. I hope you tried it >> with exact case matching. Secondly, check that none of your blocks are >> attempting to use variable-sized signals, since SimEvents doesn't support >> them. >> >> Can you create a simple version of your model that reproduces this issue >> and file a Tech Support request with it? >> >> http://www.mathworks.com/support/contact_us/index.html >> >> Thanks! >> >> -- >> Devdatt Lad >> The MathWorks, Inc. >> >> >> "Carlos Ferreira" <carlosmf.pt(a)gmail.com> wrote in message >> news:i2ms64$eln$1(a)fred.mathworks.com... >> > 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.. >> >> > >> >> > >> >> >>
From: Carlos Ferreira on 28 Jul 2010 10:45
I Solved IT! It had nothing to do with the block's that i previously indicated.... The problem was with an Attribute Scope block, that wasn't even connected to the same entity signal from the previous blocks.... It seems that the Attribute Scope which was connected in a completely different part of the model, was creating problems with the Data signal input in the stateflow block, only because i told it to scope the Data field of an entity (generated in a different part of the model but with attributes that had the same names) instead of scoping the SizeOfData attribute.... why does this happen, i don't know... but still, i know now what was creating the problem.... this seems to be a compiler error output problem.... To reproduce the problem, try this: Entity Generator -> Attribute Function Contents of Attribute Function block: function [out_Data, out_SizeOfData] = fcn() out_Data = 1:1500; out_SizeOfData = 1500; Attribute Function -> Get Attribute Contents of Get Attribute: Row 1: Data Row 2: SizeOfData Get Attribute -> Stateflow Chart Stateflow chart: "Data" is Input from Simulink with Size: 1500 "SizeOfData" is Input from Simulink with Size: -1 "GenerateEntity" is Output to simulink : Function Call type StateflowChart[GenerateEntity] -> Function Call Entity Generation Block Generation Block -> Set Attribute Contents of Set Attribute: Row 1: Data -> default 1:1500 Row 2: SizeOfData -> 1500 Set Attribute -> Attribute Scope Attribute Scope is Scoping Data Attribute Attribute Scope -> Entity Sink This should be enough to reproduce the problem... It is not necessary to have actions programmed inside the Stateflow... a simply model with no actions is enough to see the problem "Devdatt Lad" <Devdatt.Lad(a)mathworks.com> wrote in message <i2p9su$5pt$1(a)fred.mathworks.com>... > This model works for me. > > Contents of Attribute Function block: > > function [out_Data, out_SizeOfData] = fcn() > out_Data = 1:1500; > out_SizeOfData = 1500; > > Contents of Get Attribute: > > Row 1: Data > Row 2: SizeOfData > > Stateflow chart: > > "Data" is Input from Simulink with Size: 1500 > "SizeOfData" is Input from Simulink with Size: -1 > > -- > Devdatt Lad > The MathWorks, Inc. > |