Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Mitra
Posts:
2
Registered:
12/27/12
|
|
Re: Writing matrix directly into Microsoft WORD as a table
Posted:
Dec 27, 2012 11:52 AM
|
|
"Vadivelu M" <velgates@hotmail.com> wrote in message <eec26db.0@WebX.raydaftYaTP>... > Hi Jionglong, > > > Following are the R13 commands for Word-Matlab activex controls. > > > %%%%START%%%% > %Get actx handles for the word application. > word = actxserver('Word.Application'); > > > %Set visibility true. > word.Visible = 1; > > > %Add the new document > newdoc = word.Documents.Add; > > > %To insert a table into the document > %Get the selection(cursor) handle > selection = word.Selection; > matrix = rand(5, 4); > [rows, cols] = size(matrix);%get matrix size > newtable = newdoc.Tables.Add(selection.Range, rows, cols); > > > for row_idx = 1 : rows > for col_idx = 1 : cols > selection.TypeText(num2str(matrix(row_idx, col_idx))); > selection.MoveRight; > end > selection.MoveRight; > end > %%%%END%%%% > > > This will write your entire matrix contents into a word table. > > > -Vadivelu M > ===========
|
|
|
|