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

2 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2023-3-27
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.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by