如何用MATLAB代码编写microsoft word文件?

时间:2016-02-29 11:03:21

标签: matlab

我编写了matlab代码,我想在word(.doc)文件中写入结果。我怎么能够? 我使用下面的代码,但不知道如何在word文件中写入'c'的值。其中c = a + b;

my $rootpass;
my $passfile = "$jobDir/\rootpass";
print "file name = $passfile\n";
if( -e $passfile)
{    
    open ROOTPASS, '$passfile';
    $rootpass = <ROOTPASS>;
    print "$rootpass\n";
}
else
{
    print "No read permissions on password file $passfile\n";
    exit 1;
}

所有工作正常,除了我不知道如何在word文件中写入c的值,就像我们可以在文本文件fprint中打印变量的值。

2 个答案:

答案 0 :(得分:1)

您可以使用selection.TypeText(num2str(c))吗?

答案 1 :(得分:-1)

回答你的第二个问题:

str2print=strcat('The value of c is ',num2str(c));

selection.TypeText(str2print)
相关问题