How can I utlized an external program through MATLAB

Hello - I'd like to run some data analysis through MATLAB, but one part requires the use of another program. Is there a way to automatically run the program through the use of MATLAB, meaning I do all the work from MATLAB and just code what I'd like the other program to do? Thank you

12 件のコメント

OCDER
OCDER 2018 年 7 月 2 日
Depends on if the external program can be run without a user interface and takes inputs and generates outputs. Does the external program takes inputs and outputs, something like this?
ExternalProgram.exe -input myimage.png -output myprocessedimage.png
Victoria
Victoria 2018 年 7 月 2 日
I'm unsure. I tried pulling it up by using !externalprogram.exe, but I don't get anything. There's no error. It seems to run fine, but the program doesn't open up. Does this mean that it cannot run through MATLAB?
OCDER
OCDER 2018 年 7 月 2 日
You could use the system command to call the exe file as you would in the command prompt of windows. But if the program cannot accept inputs/outputs, then all your matlab program could do is open the exe file, and then the user would have to intervene and use the external program. Not sure how you'll get an automated way to run an external program from then.
Victoria
Victoria 2018 年 7 月 2 日
What would be the best way to check if I can even open the program on MATLAB?
OCDER
OCDER 2018 年 7 月 2 日
Is it an exe file?
system('c:\path_to_program\externprogram.exe')
or
winopen('c:\path_to_program\externprogram.exe')
Victoria
Victoria 2018 年 7 月 2 日
It is. I was finally apply to open the program through MATLAB, thank you! Is there any way to check if I can code something in MATLAB so that I don't actually do anything in the program and everything will be done automatically?
OCDER
OCDER 2018 年 7 月 2 日
That's what I was asking you about. Different exe files may have different input/output capabilities. You have to look for the document on using this external program - see if there's a way to pass inputs to the program directly when opening the software. I don't know what this external program is, so I can't help you at this point.
Hopefully you can do this:
system('externprogram.exe -input myimage.png -output mimage.png')
Then you can automate everything.
Victoria
Victoria 2018 年 7 月 2 日
Unfortunately, it doesn't work. Regardless, thank you for your help.
OCDER
OCDER 2018 年 7 月 2 日
編集済み: OCDER 2018 年 7 月 2 日
I didn't expect that work as you need to look up how that external program was built... Where did you get the external software from? Maybe ask the programmer if there's documents for how to pass on inputs/outputs
Victoria
Victoria 2018 年 7 月 2 日
I just did. Hopefully it'll work once I get an email back
Walter Roberson
Walter Roberson 2018 年 7 月 2 日
You could try
!externprogram.exe /help
or
!externprogram.exe -help
/help and -help and --help and /? are the commonly used methods of asking for a description of the program arguments
It is possible that you might end up needing to use Java Robot class to automate use of the program.
Victoria
Victoria 2018 年 7 月 6 日
I talked to the programmer - it isn't compatible with MATLAB as of yet. Thank you for the help.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2018 年 7 月 2 日

コメント済み:

2018 年 7 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by