MATLAB: How to get out of “>” mode after sending a system command

system command

There are a list of command line commands for communication with a Cypress chip that happen to work fine if run one at a time from command line in matlab:
system('C:\Program Files (x86)\Cypress\Programmer\ppcli.exe');
OpenPort MiniProg3/300000000000 "C:/Program Files (x86)/Cypress/Programmer"
SetPowerVoltage 5.0
SetProtocol 4
I2C_GetDeviceList
They do not work if place in a matlab script (*.m)
Any tips/tricks I am missing here?
Thanks

Best Answer

tfile = tempname;
fid = fopen(tfile, 'wt');
fprintf(fid, '%s\n', 'OpenPort MiniProg3/300000000000 "C:/Program Files (x86)/Cypress/Programmer"');
fprintf(fid, '%s\n', 'SetPowerVoltage 5.0');
fprintf(fid, '%s\n', 'SetProtocol 4');
fprintf(fid, '%s\n', 'I2C_GetDeviceList');
fclose(fid);
system([ 'C:\Program Files (x86)\Cypress\Programmer\ppcli.exe <', tfile]);
delete(tfile);
Related Question