I have a Matlab function converted to C++ using Matlab Coder. The input is a single dimensional array of :Infx1
and the output of matlab function is a 2-D array. I initialize this (the output) using
result = zeros(500,18);
Within my main loop I maintain a variable count
that varies from 1 to 500 and before the end of the loop I fill the output array using
result(count,:) = blocks;
where blocks is a 18x1 vector computed in every loop.
In my converted C++ file I expect result
to be a 2-D array. But it happens to be a vector with output given by
for (loop_ub = 0; loop_ub < 18; loop_ub++) {
result[(count + 500 * loop_ub) - 1] = blocks[loop_ub];
}
The initialization of result
can be seen as
memset(&result[0], 0, 9000U * sizeof(real_T));
I cannot figure out the reason why this is not a 2-D array. Any help is highly appreciated.
Thanks