How to get out of ">" mode after sending a system command?
2 ビュー (過去 30 日間)
古いコメントを表示
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
1 件のコメント
Star Strider
2015 年 6 月 17 日
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.
採用された回答
Walter Roberson
2015 年 6 月 17 日
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);
2 件のコメント
Walter Roberson
2015 年 6 月 18 日
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 http://stackoverflow.com/questions/450865/what-is-the-equivalent-to-posix-popen-in-the-win32-api
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Array Geometries and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!