How to run external program from matlab?

조회 수: 8 (최근 30일)
Kim Chau Tran
Kim Chau Tran 2020년 4월 6일
댓글: Kim Chau Tran 2020년 4월 6일
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
Jeff Miller
Jeff Miller 2020년 4월 6일
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.)
Kim Chau Tran
Kim Chau Tran 2020년 4월 6일
Thank you all for spend time for my question.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by