FUNCTION REFERENCE

fileread

Read a UTF-8 text file into a character row.

Read a UTF-8 text file into a character row.

Syntax

text = fileread(filename)

Reads in bounded chunks, checks cancellation and keeps every byte as read, so CRLF line endings stay (as in MATLAB). The result is limited to 65536 UTF-16 units.

Example

d=tempname(pwd); mkdir(d); f=fullfile(d,'a.txt'); fid=fopen(f,'w'); fprintf(fid,'abc'); fclose(fid); text=fileread(f); rmdir(d,'s'); text   % abc

Differences from MATLAB: Only UTF-8 input is supported; non-UTF-8 files are rejected. Character arrays have the engine size limit.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.