coder using static memory allocation.

1 回表示 (過去 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 Center および File ExchangeMATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by