フィルターのクリア

matlab script to run a perl script in a loop

1 回表示 (過去 30 日間)
Diego
Diego 2011 年 12 月 31 日
Dear all, I have a perl script that I need to run 2000 times.
myscript.pl -w i -f A1simple.fa >A1_i .fa.real. j .out
where i=3:20 and j=100.
The perl script works well for a single run, ie:
myscript.pl -w 3 -f A1simple.fa >A1_3.fa.real.1.out
However, I didn't find a way to run it in a loop.
The loop should look something like this:
for i=20:-1:3
for j=1:100
perl ('myscript.pl -w', i, '-f A1simple.fa >A1_', i, '.fa.real.', j, '.out')
end
end
Thanks in advance.
Diego

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 31 日
perl( sprintf('myscript.pl -w %d -f A1simple.fa >A1_%d.fa.real.%d.out', i, i, j) )
  5 件のコメント
Walter Roberson
Walter Roberson 2012 年 1 月 3 日
Somehow I'm not really surprised. You could take the sprintf() result and do a split on it at whitespace to create a cell array of strings, and then you could perl(TheCellArray{:})
However, I have my doubts as to whether perl itself supports the I/O redirection operator. I think you would be better off passing the output file name to the script and having the script open the file for writing. Pass the file name as the first argument and shift() before you use <> the first time.
Diego
Diego 2012 年 1 月 5 日
Thank you Walter.
I will try that in short.
Best,
Diego

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by