coder using static memory allocation.

조회 수: 2 (최근 30일)
clemens raben
clemens raben 2016년 1월 18일
답변: Rebecca Krosnick 2016년 1월 20일
Hello, I use the matlab coder to create a dynamic lib from matlab code. I will like to use static memory allocation. However, I get a compilation error for a piece of code. The code is simplified.
out = function (s)
size_s = size(s,2);
start = 1;
for i=1:size_s
....
bracket_end = bracket_end + 1;
if ()
break;
end;
end;
store =[start:brack_end]'
s(1,store) = [...];
An error pop-ups that the size of s is unbounded. So I try to use the assert like
assert(size(store,2) < 10000); % 10000 >> size (s,2);
This is not solving the problem. Then I have use the coder.var_size('data', [1, size(s,2)]), but this does not solve the problem. I'm using matlab 2015b. How can I solve the problem?
Thanks in advance, Clemens

답변 (1개)

Rebecca Krosnick
Rebecca Krosnick 2016년 1월 20일
You can configure MATLAB Coder to use static memory allocation by following the instructions at this link: http://www.mathworks.com/help/coder/ug/code-generation-for-variable-size-data.html#bsyxdsu

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by