Clear Filters
Clear Filters

How to get out of ">" mode after sending a system command?

2 views (last 30 days)
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
They do not work if place in a matlab script (*.m)
Any tips/tricks I am missing here?
  1 Comment
Star Strider
Star Strider on 17 Jun 2015
What is the result if you run them from a script? Errors? Warnings? Something else?
Saying ‘they do not work’ doesn’t provide much information.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Jun 2015
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');
system([ 'C:\Program Files (x86)\Cypress\Programmer\ppcli.exe <', tfile]);
SunnyvaleGeek on 17 Jun 2015
Thanks for your answer. One more question, is there a way to insert a delay between these commands. 'Pause(value)' would not work in a .run file.
Walter Roberson
Walter Roberson on 18 Jun 2015
No. The input goes into a file and the application asks for more input when it is ready to proceed. If it is asking for input before it is ready and does not provide a way to wait for readiness, that is a Bad Design.
You might be interested in looking at popen() . The implementation there is for Unix type systems, but you could adapt it with the information from

Sign in to comment.

More Answers (0)


Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!