フィルターのクリア

How to insert a delay in between system commands in matlab

75 ビュー (過去 30 日間)
SunnyvaleGeek
SunnyvaleGeek 2015 年 6 月 17 日
コメント済み: Walter Roberson 2015 年 6 月 18 日
I am sending a couple of commands as part of a .run file to communicate with a device. However, the commands need some delay in between, which cannot be added, as the chip commands do not have a delay.
I am looking for a way to avoid sending one command at a time as a.run file.
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 18 日
What is a .run file in this context?

サインインしてコメントする。

回答 (1 件)

Andrew Schenk
Andrew Schenk 2015 年 6 月 18 日
編集済み: Andrew Schenk 2015 年 6 月 18 日
To insert a delay between system commands, use the MATLAB pause command which will delay execution by n seconds as shown below:
system('dir')
pause(1)
system('dir')
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 18 日
The question turns out to be about creating a data file for file redirection like
system("Program.exe < thedatafile")
but the poster wanted some mechanism to be able to mark delays about when individual lines of the file data was made available to the program, all within the same system() call.
This is not possible.
Some operating systems support piping the output of processes, so a program could be written which interpreted a marked-up data file, sending the lines to output and pausing appropriately.
For example one could create a ksh / bash script such as
print "First command here"
sleep 3
print "second line"
print "third line"
sleep 20
print "4th line"
and then
system('TheScript | Program')
I do not know the MS Windows equivalent

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeQPSK についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by