coder using static memory allocation.

2 views (last 30 days)
clemens raben
clemens raben on 18 Jan 2016
Answered: Rebecca Krosnick on 20 Jan 2016
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

Answers (1)

Rebecca Krosnick
Rebecca Krosnick on 20 Jan 2016
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

Categories

Find more on MATLAB Coder 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!