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

    %% Read Text File  

% Copyright 2015 The MathWorks, Inc.


%% 
% Read the contents of the file, |fread.m|. Transpose the output array,
% |A| so that it is a row vector. 
fileID = fopen('fread.m');
A = fread(fileID,'*char')';
fclose(fileID); 

%%
% |fread| returns the character array, |A|.