Variable cell array size for mex function does not work

3 ビュー (過去 30 日間)
Marc Laub
Marc Laub 2021 年 1 月 18 日
コメント済み: Raghu Boggavarapu 2021 年 11 月 26 日
I' am trying to bypass the 32bit limit of the MatLab coder, so I chunked my matrix into pieces and wnt to give that pieces into my function. Those subatrizes are arrays within a cell.
Depending on the size of the original matrix, the number of pieces varies, but I am unable to tell MatLab Coder so.
I tried:
coder.varsize('data{:}', [1 20]);
coder.varsize('data', [1 20]);
but both did not work. In coder when I declare the dimensions of the input variables I cant change the value of the cell array dimension.
My trial code looks like:
if length(adjacend_matrix)>=cut_limit
newdata = mat2cell(cropdata, repelem(length(adjacend_matrix),1),repelem(cut_limit,parts-1));
coder.varsize('newdata{:}', [20 1]);
coder.varsize('newdata', [20 1]);
newdata = mat2cell(adjacend_matrix, length(adjacend_matrix), length(adjacend_matrix));
I dont use the cell function, which coud be a limitation according to
(unless mat2cell counts as "the" cell function). Maybe the problem is that according to limitations declaration must follow the first assignment, which is impossible using mat2cell.
Could someone tell me how to manage it that a mex function would accept newdata as input indepenenden on how many arrays are within it?
Many thanks in advance
Best regards
  1 件のコメント
Raghu Boggavarapu
Raghu Boggavarapu 2021 年 11 月 26 日
MATLAB Coder does not support changing the size/dimensions of cell array at runtime.


回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by