Using function syntax with stand alone executables

3 Ansichten (letzte 30 Tage)
David H
David H am 15 Jan. 2019
Bearbeitet: David H am 15 Jan. 2019
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?

Antworten (1)

David H
David H am 15 Jan. 2019
Bearbeitet: David H am 15 Jan. 2019
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.

Kategorien

Mehr zu Scripts finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by