Variable size cell aray of strings for codegen

조회 수: 3 (최근 30일)
Arwel
Arwel 2018년 10월 16일
Hi,
I want to pass a variable size cell array to a coder generated function. The array is a variable sized array of strings (or char), so some thing like this....
names = {'dave','susan','freddie'};
then
out = cellTest(names);
with cellTest being something like this....
function out = cellTest(myCell)
a = coder.newtype('char',[1 Inf]);
myType = coder.typeof({a},[1,Inf],[1,1]);
assert(isa(myCell,'myType'));
disp('debug');
out = myCell;
Basically what I'm trying to do is allow 'names' to be an unlimited size list (so any number of names), and also obviously each element of names can be any length.
I've tried compiling this but I'm obviously missing something, as I get...
>> codegen cellTest
??? Preconditioning: Errors occurred during evaluation of properties for function inputs. Input property specification has
certain limitations described in the documentation that might cause these errors. For example, you cannot read or write to
a function input before specifying its properties.
How can I make 'names' variable length (i.e. any number of names) and also allow each name to be a variable number of characters?
Cheers, Arwel

답변 (0개)

카테고리

Help CenterFile Exchange에서 Input Specification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by