A = fscanf(fileID,formatSpec) reads data from an open text file into column vector A and
interprets values in the file according to the format specified by formatSpec.
The fscanf function reapplies the format throughout the entire file and positions the file pointer
at the end-of-file marker. If fscanf cannot match formatSpec to the data, it reads only the
portion that matches and stops processing.
The text file is indicated by the file identifier, fileID. Use fopen to open the file, specify the
character encoding, and obtain the fileID value. When you finish reading, close the file by
calling fclose(fileID).
A = fscanf(fileID,formatSpec,sizeA) reads file data into an array, A, with
dimensions, sizeA, and positions the file pointer after the last value read. fscanfpopulates A in
column order. sizeA must be a positive integer or have the form [m n], where m and n are
positive integers.
[A,count] = fscanf(___) additionally returns the number of fields that fscanf reads into A.
For numeric data, this is the number of values read. You can use this syntax with any of

Related Interests