How can I pass the output of my MATLAB Compiler generated standalone executable to an operating system environment variable?

2 visualizzazioni (ultimi 30 giorni)
I have a MATLAB function that returns an output argument. When I compile this to a standalone executable and run it from a Windows command prompt, the value of the output variable is displayed. I would like to store this output in a system environment variable.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 26 Mar 2023
Modificato: MathWorks Support Team il 27 Mar 2023
In a Microsoft DOS/Windows based operating system there is no simple command to store the output of an executable to an environment variable. The following website has some pointers on how to accomplish this using various third-party tools:
This task is simpler in a UNIX based operating system where amongst others, you have the following options:
1. Use pipes with xargs to pipe the output of the executable to the SETENV or equivalent command.
2. Use the backtick operator to redirect the output to the SETENV or equivalent command.
Please refer to the appropriate MAN pages for the exact syntax for your UNIX based operating system.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by