runing an exe file with respectly inputs

i am running an external .exe file by matlab, but for giving the inputs to this exe file,i should enter the inputs accordingly: first input(for example:120),then press enter, the second input(for example:7120),then press enter ,.... after finishing I will get the output from exe file is there any solution do produce a code to do automatically by matlab specially for introducing inputs?

1 Comment

call it from the commandline and write the input values right after the exe filename.

Sign in to comment.

Answers (2)

HAMID
HAMID on 23 Jul 2013
Edited: Azzi Abdelmalek on 23 Jul 2013
actually i found the solution 1-make a txt file by fprint command,if you need enter after each input,just put \n
d1 = fopen('inputsofexefiletest.txt' ,'w');
txt = num2str(Bikeda(1));
,.....
fprintf(fid1,'%s\n',txt1);
,....
fclose(fid1);
2-use this command:
system('exefilename.exe<inputsofexefile.txt')
You have to use other then Matlab interface to display or introduce data, for example inputdlg function
a=inputdlg('enter a')
see also
msgbox
listdlg

Asked:

on 23 Jul 2013

Community Treasure Hunt

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

Start Hunting!