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 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

Kaustubha Govind
Kaustubha Govind il 10 Mag 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.

Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by