Stateflow problem with array contains structs
1 view (last 30 days)
Show older comments
we have this matlab code:
function od = initOD
% struct entry erstellen
subEntry.access=3; % 0=r/w 1=w 2=r 3=nicht belegt
subEntry.value=NaN;
entry.index=0;
entry.subindex = [subEntry];
% array aus entry structs erstellen
od = [entry];
% entrys befuellen
od(1).index =hex2dec('1000');
od(1).subindex(1).value=131478;
od(1).subindex(1).access=2;
od(2).index =hex2dec('1001');
od(2).subindex(1).value=0;
od(2).subindex(1).access=2;
od(3).index =hex2dec('1008');
od(3).subindex(1).value='device';
od(3).subindex(1).access=2;
od(4).index =hex2dec('1008');
od(4).subindex(1).value='device';
od(4).subindex(1).access=2;
od(5).index =hex2dec('1016');
od(5).subindex(1).value=1;
od(5).subindex(1).access=2;
od(5).subindex(2).value=0;
od(5).subindex(2).access=0;
od(6).index =hex2dec('1016');
od(6).subindex(1).value=0;
od(6).subindex(1).access=0;
od(7).index =hex2dec('1018');
od(7).subindex(1).value=1;
od(7).subindex(1).access=2;
od(7).subindex(2).value=1; % Vendor ID
od(7).subindex(2).access=2;
od(8).index = hex2dec('1F80');
od(8).subindex(1).value=NaN; %NMT Startup
od(8).subindex(1).access=0;
is it possible to run this funktion in stateflow? we are using structs because of code generation. It has to be compatibel with code generation. one of the error is this:
Class mismatch (double ~= struct).
The class to the left is the class of the left-hand side of the assignment.
Function 'initOD' (#767.201.203), line 10, column 1:
"od"
Launch diagnostic report.
We are blody beginners don´t know how to handle this.
0 Comments
Answers (0)
See Also
Categories
Find more on Digital Input and Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!