Variable Size signal and upper bounds

1 visualización (últimos 30 días)
Christian
Christian el 3 de Dic. de 2013
Respondida: Milad Kahrobaee el 26 de En. de 2018
Hi, I have this simple exemplary code in a Matlab Embedded Simulink Function (Matlab 2012b)
function y = myfun(n)
coder.varsize('y', [1 1024]);
y = zeros(1,n);
I have also declared y to be a variable-size output.
But when running the model he keeps complaining:
"Output 'y' (#404) has variable size but the upper bound is not specified; explicit upper bound must be provided."
What am I doing wrong?
Thanks for your kind help.
Chris

Respuestas (2)

Sankirna Joge
Sankirna Joge el 12 de Nov. de 2016
Editada: Walter Roberson el 13 de Nov. de 2016
hello, i am also getting the same error but here i am passing image information to output in simulink ..
i defined
coder.varsize('y4',[0,255]);
where, y4 = [ x1, x2, x3, x4];
where, x1 = im2double(I1);
where, I1 = imread('one.jpg');
similar for x2,x3 and x4 also with their respective I2, I3, I4 values and then y4 passed to video viewer block
where i am failing to solve it ?

Milad Kahrobaee
Milad Kahrobaee el 26 de En. de 2018
You can work around it by:
function y = myfun(n)
assert (n <= 6);
y = zeros(1,n);
you should set the upper bounds for the output ("Y") in the "Edit Data" ("Size" section) and of course you should check the "Variable Size" checkbox.

Community Treasure Hunt

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

Start Hunting!

Translated by