How to run external program from matlab?

Dear all
I want to run external program from matlab. In my case is HMS rainfall runoff model. I can open HMS software with system command (HMSapp = system('C:\Program Files (x86)\HEC\HEC-HMS\4.3\HEC-HMS.exe')). But after that, I don't know how to open and run an exit model (in this location 'C:\Users\Computer\Desktop\Test_HMS\test\test.hms')
Other question, I want to change some parameters in this file 'C:\Users\Computer\Desktop\Test_HMS\test\Basin_1.basin' and rerun model in serveral time.
Anyone can help me? Thanks
TKC

6 Comments

What are the command line interface options of your program?
I do not know your question. My problem is I can open HMS progame. But I do not know how to run an exit file (belong to model) which is show in location about. I want to write a commant to run HMS model via matlab.
We do not know the details of your particular software. We can help you with Matlab questions, so you will have to describe what is your specific question.
If you know the location of the output file, what is your question? And if you know the location of your configurion file you should be able to read and write from it if it is a plain text file.
My problem is I do know how to control model, I need some simple example to do that. For example in windown enviroment. After open sofware, I will use open function to open exit model. Then click run to excute model.
I want to do this in matlab. I found "system" command to open software. But for the next step, I do know how to to them.
As Rik says, it all depends on what command line options your HMS program supports. For many programs, you could use a command with your input file at the end, like this:
HMSapp = system('"C:\Program Files (x86)\HEC\HEC-HMS\4.3\HEC-HMS.exe" C:\Users\Computer\Desktop\Test_HMS\test\test.hms')
For different runs, tou could modify the input file test.hms with a regular editor if it is a plain text file, or write MATLAB commands to generate the test.hms files that you want for those runs.
If test.hms is not a plain text file, you will probably have to create them from inside the HMS application.
We can only guess without knowing exactly what the command line options are for the HMS program. (By the way, the 'command line options' are the options accepted in the system command after HEC-HMS.exe.)
Thank you all for spend time for my question.

Sign in to comment.

Answers (0)

Categories

Asked:

on 6 Apr 2020

Commented:

on 6 Apr 2020

Community Treasure Hunt

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

Start Hunting!