creating vector in matlab fcn bock
1 次查看(过去 30 天)
显示 更早的评论
hi, i wanna to create a vector in matlab fcn block, that s my Code:
function y = fcn
e = 160;
s = 45;
vector = (s:e);
y = vector
but i get this error: Output 'y' (#4Cool has variable size but the upper bound is not specified; explicit upper bound must be provided.
can u guys help me to solve that?
THX
2 个评论
Simon
2013-9-13
Hi!
I see no problem. Pasting your code in a function file and executing
result = fcn;
gives a resulting vector ranging from 45 to 160.
回答(3 个)
Simon
2013-9-13
Hi!
If you have trouble defining functions in Matlab, start here: http://www.mathworks.com/help/matlab/matlab_prog/create-functions-in-files.html
0 个评论
Kaustubha Govind
2013-9-13
Please use coder.varsize to define an upper-bound for the output variable as I have previously explained here. You also need to configure the MATLAB Function block for a variable-size output.
0 个评论
Fred Smith
2013-9-23
For this particular piece of code, variable-sizing should not be needed as the end points are constants. This example works fine for me in a recent version. What version of MATLAB and Simulink are you using?
You can find this out using the ver command: >> ver
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!