This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Read contents of file as text


text = fileread(filename)


text = fileread(filename) returns a character vector that contains the contents of the file specified by filename. Specify filename as a character vector.


Read and search the file Contents.m in the MATLAB® iofun directory for the reference to fileread:

% find the correct directory and file
io_contents = ...

% read the file
filetext = fileread(io_contents);

% search for the line of code that includes 'fileread'
% each line is separated by a newline ('\n')

expr = '[^\n]*fileread[^\n]*';
fileread_info = regexp(filetext,expr,'match');
Was this topic helpful?