MATLAB: Running an .EXE file with an Input file with a command via matlab

commandexe fileinputMATLABrun

Hello,
I have a code problem. The purpose is to run an .exe file via command.
I have find the command which is system('file.exe &').
But this file needs an input file ( a .txt file (the name of this file is ab.txt) in cmd file) in order to run.
I have tried these commands but it is no works :
status = system(sprintf('file.exe "%s"',ab.txt));
Could anyone help me?

Best Answer

sprintf might be overkill here. Maybe just:
status = system('file.exe ab.txt')
If file.exe is not on the Windows path, you might need to include the information about where it is, e.g.
status = system('C:\Software\Bin\file.exe ab.txt')