Variable Size signal and upper bounds

1 回表示 (過去 30 日間)
Christian
Christian 2013 年 12 月 3 日
回答済み: Milad Kahrobaee 2018 年 1 月 26 日
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

回答 (2 件)

Sankirna Joge
Sankirna Joge 2016 年 11 月 12 日
編集済み: Walter Roberson 2016 年 11 月 13 日
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 2018 年 1 月 26 日
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