cell operations for varargin and varargout
1 次查看(过去 30 天)
显示 更早的评论
Hi fellows matlab. I wrote the next code into MATLAB embedded function block from SIMULINK, but I get the next warning advice in the embedded MATLAB editor wich I don't know how to resolve..
if true
error(nargchk(1,2,nargin));
[n,dims] = size(xy);
numels = n*n*dims;
opt = 2; if numels > 5e4, opt = 3; elseif n < 20, opt = 1; end
for var = varargin
if length(*var{1})* == 1
opt = max(1, min(4, round(abs*(var{1}*))));
else
error('Invalid input argument.');
end
end
the message said the embedded MATLAB only supports cell operations for varargin and varargout pointing var{1}
how should I resolve it? regards!!
0 个评论
回答(1 个)
Ryan G
2012-11-6
Unfortunately cell arrays are not really supported for code generation, which is essentially what embedded MATLAB does to run.
If you do not require code generation for this part of the model, you can define the function externally, define the function as extrinsic:
coder.extrinsic('myMatlabFunction')
at the beginning of your embedded matlab code, then call it as you normally would. This tells the block to call the function using the MATLAB interpreter instead of trying to generate code.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!