1 %>@ingroup datasettools
3 %> @brief does a series of tests on the dataset file to
try to guess its format
6 if ~exist(filename, 'file')
7 irerror(sprintf('File "%s" does not exist!', filename));
11 id = fopen(filename, 'r');
14 irerror(sprintf('Could not open file "%s"', filename));
22 if strcmp(
char(s)', 'MATLAB')
31 if strcmp(lower(s(1:7)), 'irtools') || strcmp(lower(s(1:5)), 'iroot')
39 if s >= 48 && s <= 57 || s == '-'
40 % If contents starts with a number, the file type is likely "basic"
45 if sum(s == sprintf('\t,; ')) > 0 % Tests CSV common separators
46 % If file starts with a separator, file type is likely to be the Pirouette table
53 if sum(s == [10, 10, 254, 254]') == 4
62 %
irerror('Could not detect type of file ''%s''', filename);
63 irwarning(sprintf('Could not detect type of file ''%s''', filename));
65 irverbose(sprintf('File type detected for file ''%s'': ''%s''', filename, classname), 1);
function irverbose(in s, in level)
function detect_file_type(in filename)
"Pirouette" TXT loader/saver
function strip_quotes(in s)
Dataset loader for OPUS "0" files.
Dataset loader/saver for mat files.
IRootLab TXT loader/saver.