I am reading on the Matlab help about coder.varsize. In particular, I read that
Declare Variable-Size Array with a Mix of Fixed and Variable Dimensions Specify that A is an array whose first dimension has a fixed size of three and whose second dimension has a variable size with an upper bound of 20. function fcn() ... coder.varsize('A',[3 20], [0 1] ); ... end
What does it mean by fixed dimesion ? Consider below example
function [x,y] = usevarsize(n) %#codegen x = 1; %x = ones(2); coder.varsize('x',[1 12],[0 1]); y = size(x); if n > 10 x = 1:n; end
codegen usevarsize -args {0} -report
>> usevarsize_mex(11) ans = 1 2 3 4 5 6 7 8 9 10 11
>> usevarsize_mex(14) Error using usevarsize (line 8) Size overflow error on dimension 2: upper bound is 12, but actual size is 14.
function [x,y] = usevarsize(n) %#codegen x = 1; %x = ones(2); coder.varsize('x',[1 inf],[0 1]); y = size(x); if n > 10 x = 1:n; end
Here I am declaring the second dimension of 'x' as unbounded. So 'x' can be any length 1-D vector :
codegen usevarsize -args {0} -report >> usevarsize_mex(24) ans = Columns 1 through 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Columns 23 through 24 23 24
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.