Terminate program once input is required using system()
3 views (last 30 days)
Hi. I am trying to run TRNSYS through MATLAB in a script. So far it looks like this (simplified):
Deckname = ['TRNSYS_A1_',num2str(idxAS),'.DCK'];
Deckpath = 'D:\Trnsys_Coll\';
Trnpath = 'C:\Program Files\Trnsys16_1\Exe\';
Trnrun = ['Trnexe.exe ',Deckpath,Deckname];
The problem is that the program I am running requires an input (such as enter) to close. So my MATLAB-code gets "stuck" at the line
saying it is busy. Is there a way I can terminate the program once the input is required? It would take too long to do it manually, because it's all in a very long loop.
Friedrich on 9 May 2014
Edited: Friedrich on 9 May 2014
maybe use piping and pipe in a txt file with one empty line. So create a new txt file which contains one line (simply press enter once in the txt file) and save it in some folder with some name. Then when you call your Trnexe.exe pipe in that file by using:
Trnrun = ['Trnexe.exe ',Deckpath,Deckname, '<C:\some_folder\some_file.txt'];
So when the application wants in input it doesn't use STDIN it uses one line of the txt file. This basically simulates the enter press. Let me know if that works for you.