Try the following scheme using the java.awt.Robot class.
r = java.awt.Robot;
system([myfile.exe ' &']); % dont forget to use the correct path if needed
pause(2) % allow some time for the computer to process
system([your_input_file_name ' &']);
r.keyPress (java.awt.event.KeyEvent.VK_ENTER); % press "enter" key
r.keyRelease (java.awt.event.KeyEvent.VK_ENTER); % release "enter" key
Another option is to use .net object if you are in windows by using SendWait and SendKeys, for example:
NET.addAssembly('System.Windows.Forms'); % import the .NET assembly
sendkey = @(strkey) System.Windows.Forms.SendKeys.SendWait(strkey) ; %useful function for the next lines:
%% now let's get started
system('myfile.exe &') ;
pause(2);
sendkey('your_input_file_name')
sendkey('{ENTER}'); % press ENTER
credit to Luis Mendo and Hoki for telling me all about this
.exeasking for a file name, you should be able to pass it as a parameter via the system call:!myfile.exe filenameor (if you need the current file name)system(['myfile.exe ',mfilename('fullpath')]).systemallows for dynamic string input. That said, if the.exedoesn't accept the filename as a direct input, you'll have to manually enter the filename it needs via the Matlab command window I'm pretty sure.&for the end of the system call; then enter the filename in that shell and all comments will be restricted to the instance.