Copy and Paste Table into Word
조회 수: 38 (최근 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개)
BhaTTa
2024년 7월 17일
I assume you want to create tables in MS Word. The following MATLAB Answers links have similar queries, you can check these out:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!