필터 지우기
필터 지우기

Variable Size signal and upper bounds

조회 수: 5 (최근 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