필터 지우기
필터 지우기

How to save the output of an executable file in a different directory than current running directory?

조회 수: 3 (최근 30일)
I am running an executable file using system command in matlab. The output which I get after the processing is to be saved in a different directory. Can anybody please help me out with this? Thank you.

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2017년 7월 24일
Run your MATLAB script or function in your desired directory, use system() command by specifying the location of your executable, e.g. system('c:\myFolder\myExecutable.exe')
  댓글 수: 1
Nidhi SRIVASTAVA
Nidhi SRIVASTAVA 2017년 7월 24일
편집: Nidhi SRIVASTAVA 2017년 7월 24일
Thanks for the answer. But I guess it's not working in my case. I tried system([data_directory,'\SDISP96.exe &']). The executable file reads a file 'file1' which is in required 'data_directory'. But it isn't reading the file 'file1' from data_directory but from the current directory. Could you help me out with this problem, please?

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


Walter Roberson
Walter Roberson 2017년 7월 24일
Your executable does not appear to have any way to tell it which directory to read from (other than perhaps the current directory) or which location to write to (other than perhaps the current directory).
Potentially the executable has command line options telling it what to do, but that would be at the executable level.
Perhaps you could copy the input file into the directory where you need the output, cd to there, run the program

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by