Create the table in the MS word
    22 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hi,
I have a guestion, since still I do not know how to process with tables, that are going to be exported into word file. I would like to create any table and then for example put figure into one cell and a text into the other one. Can someone give me the example code, that could help me to get familiar with processing tables ?
Thank you
0 件のコメント
回答 (1 件)
  Kavya Vuriti
    
 2019 年 11 月 26 日
        Hi, 
Assuming you are trying to create a table of images and text in different columns, images can be stored as arrays in the table.  If you have a folder containing images named ‘myfolder’ and a MATLAB variable named ‘imagecontent’  stored as cell array of strings with the text corresponding to images , the following sample code can be used to create table:
% List contents of the folder
info = dir myfolder; 
% Get number of images in the folder
numimages = numel(info); 
% Create table
T = table(cell(1, numimages), imagecontent); 
for k = 1:numimages 
    filename = info(k).name; 
    % Fill the table with image information
    filecontent = {imread(filename)}; 
    T(k,1) = filecontent; 
end 
 Also note that length of vector ‘imagecontent’ must be same as number of images to create table. While exporting a table from MATLAB, only specific file formats are supported. Refer this link for supported file formats. 
Refer to the following link for more information on working with tables:https://www.mathworks.com/help/matlab/matlab_prog/create-a-table.html#CreateAndWorkWithTableExample-1 
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Use COM Objects in MATLAB についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

