Variable size cell aray of strings for codegen

3 visualizaciones (últimos 30 días)
Arwel
Arwel el 16 de Oct. de 2018
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

Respuestas (0)

Categorías

Más información sobre Input Specification en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by