I assume you want to create tables in MS Word. The following MATLAB Answers links have similar queries, you can check these out:
Copy and Paste Table into Word
43 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to copy and paste into MS Word a table from my code and i couldn't find a way to do it so. I'd like to paste and show in the same way Matlab shows the results on MS word.
I need ur help
Below the code i've been working.
% % % Display names
load_system(gcs);
Blockpaths= find_system(gcs,'Type','Block');
NOM =[];
for i = 1:length(Blockpaths)
b =strsplit(char(Blockpaths(i)),'/');
NOM =[NOM;b(end)];
end
% % % Display Types
open_system(gcs);
blks = find_system(gcs,'Type','block');
TYPE = get_param(blks, 'BlockType');
j = 1;
k = 1;
for i = 1:length(TYPE)
if ( strcmp(TYPE{i},'Inport'))
In{j} = blks{i};
In{j} = strrep(In{j},gcs,'');
j = j + 1;
elseif ( strcmp(TYPE{i}, 'Outport'))
Out{k} = blks{i};
Out{k} = strrep(Out{k},gcs,'');
k = k + 1;
end
end
% % % Create table
CONTENU=cell(length(Blockpaths),1);
t=table(NOM,TYPE,CONTENU);
SRCBLOCK=cell(length(Blockpaths),1);
t=table(NOM,TYPE,CONTENU,SRCBLOCK)
word = actxserver('Word.Application');
word.Visible = true;
wdoc = word.Documents.Add;
Selection = word.Selection;
table = Selection.Tables.Add(Selection.Range,size(t,1),4);
table.Columns.Borders.Enable = 1;
0 个评论
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!