How can I vary function input matrix size in coder (mexing)? I have used 'Make Sizes Variable' option but this doesn't seem to work.

1 view (last 30 days)
Hi there,
I am using the coder toolkit to mex my function, this is the first few lines of my function:
function [deviations] = dstest_function(member_location_table, peculiar_velocities)
%#codegen
coder.inline('never')
I need to vary the size of 'member_location_table' e.g.: 10 x 3, 20 x 3 etc. Using the coder toolkit, I set the 'Make Sizes Variable' option so that the size of the inputs looks like this:
:10 x :3
However, when running the function with member_location_table size 20 x 3, I get the following error message:
MATLAB expression 'member_location_table' is not of the correct size: expected [:10x:3] found [20x3].
Error in dstest_function_mex
Thank you for your help in advance, it is greatly appreciated!
Lyndsay

Answers (1)

Kaustubha Govind
Kaustubha Govind on 10 May 2013
The size that you set for a variable-size input - [10x3] - is supposed to specify the maximum-size of that input. You may want to try using [Inf 3] if you don't want to limit the size of the first dimension.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!