Using function syntax with stand alone executables

3 次查看(过去 30 天)
If I generate a stand alone executable, lets call it myfun.exe, can I call this using the function rather than command syntax?
In matlab I would call call
myfun('input_files', { 'some_path', 'some_other_path'})
But if I call the executable from the command line, I only know how to use the command syntax and if I write
myfun.exe / input_files { 'some_path', 'some_other_path'}
It just assumes the second argument is a string.
Is there anyway to make it not interpret this as a character vector, or use the command syntax for the executable?

回答(1 个)

David H
David H 2019-1-15
编辑:David H 2019-1-15
Having looked through all the answers to do with this, it appears it is just truly awful. I'm tempted to make a wrapper of the function of the form
Function Myfun_wrapper(in_string)
eval(strcat('myfun',in_string))
and just compiling that.
The only other alternative is to have something parse all the arguments, which could be specified using either syntax (so could be numerical arrays, or cell arrays, or structs OR character arrays which if evaluated as eval(['input=',input]) would give those things). This is just terrible.
Is there even a way to tell if a function was called with the function syntax or the command syntax? It would make this much easier.

类别

Help CenterFile Exchange 中查找有关 Scripts 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by