Pass a struct parameter to a MATLAB mcc-compiled executable on Windows -
on windows, compiled using mcc matlab script takes struct parameter , writes output file. when try call on windows' cmd using
func.exe "struct('field','data')"
or
func.exe struct('field','data')
i get
attempt reference field of non-structure array. error in func (line 3) matlab:nonstrucreference
passing struct uncompiled script through matlab works, e.g.
matlab /nosplash /nodesktop /r "func(struct('field','data')),exit"
assuming still wish pass struct , not distinct arguments (so can specify optional arguments run), there workaround? (google didn’t help!)
thanks!
with info daniel , navan, workaround implemented (given argument called args) is
if (ischar(args)); evalc(sprintf('args=%s;',args)); end
which works both in compiled executable , calling directly within matlab. assumes user has done sanity checking.
Comments
Post a Comment