Question: I wrote matlab code and I want to write result in word (.doc) file. How can I?
I used below code but dont know how to write value of 'c' in word file. where c=a+b;

```
clc;
word = actxserver('Word.Application');
word.Visible = 1;
document = word.Documents.Add;
selection = word.Selection;
selection.TypeText('Hello world. ');
selection.TypeText('My name is Professor Kitchin');
selection.TypeParagraph;
selection.TypeText('How are you today?');
selection.TypeParagraph;
selection.TypeText('Big Finale');
selection.Style='Heading 1';
selection.TypeParagraph;
a=34;
b=23;
c=a+b;
H1 = document.Styles.Item('Heading 1');
H1.Font.Name = 'Garamond';
H1.Font.Size = 20;
H1.Font.Bold = 1;
%H1.Font.TextColor.RGB=60000; % some ugly color green

selection.TypeParagraph
selection.TypeText('That is all for today!')
document.SaveAs2([pwd '/test.docx']);

```

All are working fine except i dont know how to write value of c in word file, Like we can print values of variables in text file fprint.

Answer: 
Can you use `selection.TypeText(num2str(c))`?
Answering your second question:

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

selection.TypeText(str2print)

```