%Formatted File Input

% Recall: we can open a file for reading by using:
%fileID = fopen(filename,'r');

% Then we can use fscanf to read from the file
%A = fscanf(fileID, formatSpec)

%Reads and convert data from a text file into the matrix A using formatSpec
%formatSpec is similar to fprintf, additionally:
%   Use * to skip file to read in
%   Can match specific text (e.g. '\nN=')
%   If it cannot match formatSpec to the data, it reads only the portion
%   that matches and stops processing

%Can also call with a third argument:
%A = fscanf(fileId, formatSpec, sizeA);

%sizeA indicates the number of elements to read into A,
%   Can be scalar int or [m, n] or Inf (reads to the end of the file)
%   1 reads a single scalar number or a single string

%Note: if data is in rows x cols format, read it in [cols, rows] and take
%its transpose
%   This happens due to MATLAB reading in column major order (reads columns
%   first)
%   See the provided code at the beginning of homework 6

%Formatted file example

%Expected format:
% <two word title>
% N=<number of measurements>
%
% hh:mm:ss
% dd-mmm-yyyy
% <matrix of data values>
% hh:mm:ss
% dd-mmm-yyyy
% <matrix of data values>
%
% etc.