我有一个调用Perl脚本的matlab函数,该函数将大型文本文件转换为二进制文件以便在Matlab中使用。看到这里的Perl脚本的详细信息:Parsing unsorted data from large fixed width text在Matlab中实时显示Perl脚本的输出
我的Matlab的功能看起来像这样
function convertMyData(dataFileName)
%Do some checks on the data
disp('Done Checking Stuff!');
%Process data file with Perl
perl('myPerlScript.pl',dataFileName)
% More Processing on the Binary output from Perl
disp('All Done!');
在perl脚本是表示,因为它可能需要几分钟到转换脚本的进度一些打印语句。事情是这样的:
while ($line = <INFILE>) {
if ($lineCount % 100000 == 0){ #Display Progress every 100,000 lines
print "On Line: ".$lineCount."\n";
}
#PROCESS LINE DATA HERE
$lineCount ++;
} # END WHILE <INFILE>
print "Finished Reading: ".$lineCount." Lines\n";
的问题是,在Matlab我所有的“上线:XXXXX”一旦脚本完成,而不是在像Matlab的disp()
提示实际显示print
声明只是被人抛弃到Matlab的默认ans
变量功能。
那么如何在外部程序的输出显示在Matlab提示符运行时(如果可能)呢?