File: loadHashTable.m

package info (click to toggle)
matlab2tikz 1.1.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,668 kB
  • sloc: objc: 6,143; makefile: 55; sh: 40
file content (19 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function hashTable = loadHashTable(suite)
    % loads a reference hash table from disk
    hashTable.suite = suite;
    hashTable.contents = struct();
    filename = hashTableName(suite);
    if exist(filename, 'file')
        fid = fopen(filename, 'r');
        finally_fclose_fid = onCleanup(@() fclose(fid));

        data = textscan(fid, '%s : %s');
        if ~isempty(data) && ~all(cellfun(@isempty, data))
            functions = cellfun(@strtrim, data{1},'UniformOutput', false);
            hashes    = cellfun(@strtrim, data{2},'UniformOutput', false);
            for iFunc = 1:numel(functions)
                hashTable.contents.(functions{iFunc}) = hashes{iFunc};
            end
        end
    end
end