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

    %% Write Table to Space-Delimited Text File  

% Copyright 2015 The MathWorks, Inc.


%% 
% 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 space-delimited text file named |myData.txt| and display 
% the file contents. 
writetable(T,'myData.txt','Delimiter',' ')  
type 'myData.txt' 

%%
% |writetable| appends a unique suffix to the variable name, |Var2|, above
% the two columns of corresponding data.