Embedded coder multidimensional array change order of generated code
Show older comments
Hello to all,
I have a question about code generation. The following Matlab embedded function:
function out = UserPinComparator(pinDB, numberOfRow, toCompare,length)
i = uint8(1);
j = uint8(1);
out = uint8(1);
for i= uint8(1):uint8(1):numberOfRow
out = uint8(1);
for j= uint8(1):uint8(1):length
if(pinDB(i,j) ~= toCompare(j))
out = uint8(0);
end
end
if(out == uint8(1))
break;
end
end
where pinDB is a [30 8] multidimensional array has a following generated c code from emebbed coder:
/* Function for Chart: '<Root>/Chart' */
static uint8_t UserPinComparator(const uint8_t pinDB[240], uint8_t numberOfRow,
const uint8_t toCompare[8], uint8_t length)
{
uint8_t out;
uint8_t i;
uint8_t j;
boolean_T exitg1;
/* MATLAB Function 'UserPinComparator': '<S1>:1363' */
/* '<S1>:1363:5' */
out = 1U;
/* '<S1>:1363:7' */
i = 1U;
exitg1 = false;
while (!exitg1 && i <= numberOfRow) {
/* '<S1>:1363:7' */
/* '<S1>:1363:8' */
out = 1U;
/* '<S1>:1363:9' */
for (j = 1U; j <= length; j++) {
/* '<S1>:1363:9' */
if (pinDB[i + 30 * (j - 1) - 1] != toCompare[j - 1]) {
/* '<S1>:1363:10' */
/* '<S1>:1363:11' */
out = 0U;
}
}
if (out == 1) {
/* '<S1>:1363:15' */
exitg1 = true;
} else {
i++;
}
}
return out;
}
I know that Embedded coder fuse a multidimensional array in to unidimensional array, but there is the possibility in Emebedded coder to change the order like pinDB(1,1) pinDB(1,2) pinDB(1,3) etc instead of pinDB(1,1) pinDB(2,1) pinDB(3,1)?
Kind Regards
Riccardo Capponi
Answers (0)
Categories
Find more on Texas Instruments C2000 Processors in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!