www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/WriteTabletoSpecificSheetandRangeinSpreadsheetExample.m

    %% Write Table to Specific Sheet and Range in Spreadsheet   

%% 
% Create a table. 
T = table(['M';'F';'M'],[45 45;41 32;40 34],...
    {'NY';'CA';'MA'},[true;false;false])  

%% 
% Write the table to a spreadsheet named |myData.xls|. Include the data
% on the second sheet in the 5-by-5 region with corners at |B2| and |F6|. 
writetable(T,'myData.xls','Sheet',2,'Range','B2:F6') 

%%
% Excel(R) fills the row of the spreadsheet from |B6| to |F6| with |#N/A|
% since the range specified is larger than the size of the input table |T|.