How can I write output of MATLAB to MS Word? -
i reading input of matlab code excel file using xlsread
, after calculation exporting word writing out report(writetoword.m). in excel, there string should read in matlab , output in word.
in excel file(input.xlsx) written 'shoe'.
i read using
[num,txt,raw] = xlsread('input.xlsx'); eng = txt(14,19); % word 'shoe' in excel cell
in writetoword.m
, wrote,
test = eng; wordtext(actxword,test,style,[0,1]); function wordtext(actx_word_p,text_p,style_p,enters_p,color_p) if(enters_p(1)) actx_word_p.selection.typeparagraph; end actx_word_p.selection.style = style_p; if(nargin == 5) actx_word_p.selection.font.color=color_p; end actx_word_p.selection.typetext(text_p); actx_word_p.selection.font.color='wdcolorautomatic'; k=1:enters_p(2) actx_word_p.selection.typeparagraph; end return
it not printing anything. error in line
actx_word_p.selection.typetext(text_p);
now if write
test = 'eng'; wordtext(actxword,test,style,[0,1]);
it come eng , not shoe.
how can fix problem?
you're assigning txt
cell instead of string. use eng = txt{14,19};
instead.
Comments
Post a Comment