How can I call a .com function through MatLab

조회 수: 3 (최근 30일)
Casey
Casey 2012년 11월 13일
I have a .COM file that can be run through the windows cmd prompt. This file takes 3 user inputs to run. I'd like to be able to run this function in a batch with per-determined inputs.
I've tried using the system and dos functions as follows:
system('myfile.com arg1 arg2 arg3')
system('"myfile.com" arg1 arg2 arg3')
dos('myfile.com arg1 arg2 arg3')
dos('"myfile.com" arg1 arg2 arg3')
These seem to put matlab in an endless loop. I know that the .com program take a short time to run, but when I attempt to call it in this way matlab just runs and I need to use 'ctrl + Break' to stop. Any advice would be appreciated.
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 11월 13일
Does it take the user inputs on the command line, or does it prompt for them?
Casey
Casey 2012년 11월 13일
To run the program I type the name into the cmd line and then get prompted 3 times to enter the 3 inputs

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 11월 13일
In MATLAB, create a file that contains the three input files, one per line. Then,
system(['myfile.com <' TheFileName])
  댓글 수: 11
Walter Roberson
Walter Roberson 2012년 11월 14일
That approach is not going to work. Unfortunately I do not have time at the moment to explore.
Casey
Casey 2012년 11월 14일
okay thank you for your help

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by