Christian
unread,Mar 4, 2014, 12:21:07 PM3/4/14You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I'm trying to create some mex files using the Coder tool in matlab. Is it possible to specify optional input arguments for those files?
Since the 'exist' command is not available for Coder I input optional arguments via [] in my original m-file. E.g.
function y=example(a,b,opt1,opt2)
'some code'
if isempty(opt1)==1
'perform some operations relying on code above'
end
'more code'
end
Then I call this function like this
z=example(a,b,[],[])
This approach is a bit clumsy, but thought it might work with mex files, but when I call the mex file using
z=example_mex(a,b,[],[])
I get an error saying that op1 is not of the correct size (which makes sense to me). Is there a clean way to deal with this, or do I have to set up sth like
z=example_mex(a,b,zeros(size(opt1)),zeros(size(opt2)))
and then change the if statement in the m-file to
if sum(opt1(:))==0
which probably takes up some computation time.