~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychFiles/ReadStructsFromText.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
% 08/06/03  dhb         Handle fgetl returns empty string.
22
22
% 08/22/07  dhb         This was modified on disk but not commented our uploaded to SVN repository.
23
23
% 4/26/12   dhb         Squeeze '/' out of field names too.
 
24
% 5/31/12   dhb         Squeeze '*' out of field names too.
 
25
% 6/7/13    dhb         Suppress uninteresting warning on str2num.
24
26
 
25
27
% Open the file
26
28
fid = fopen(filename);
67
69
        newField = [];
68
70
        oldField = theFields{i};
69
71
        for j = 1:length(oldField)
70
 
                if (~isspace(oldField(j)) && oldField(j) ~= '.' && oldField(j) ~= '/')
 
72
                if (~isspace(oldField(j)) && oldField(j) ~= '.' && oldField(j) ~= '/' && oldField(j) ~= '*')
71
73
                        newField = [newField oldField(j)];
72
74
                end
73
75
        end
98
100
                        % because the str2num function calls eval on its input which
99
101
                        % will cause it to execute.
100
102
                        if isempty(which(values{j})) && isempty(which(strtok(values{j})))
 
103
                oldWarn = warning('off','MATLAB:namelengthmaxexceeded');
101
104
                                convertedValue = str2num(values{j}); %#ok<ST2NM>
 
105
                warning(oldWarn.state,'MATLAB:namelengthmaxexceeded');
102
106
                        end
103
107
 
104
108
                        % If the value successfully converted, overwrite what was
116
120
        f = 1;
117
121
        while (1)
118
122
                theLine = fgetl(fid);
119
 
                if (isempty(theLine) | theLine == -1)
 
123
                if (isempty(theLine) || theLine == -1)
120
124
                        break;
121
125
                end
122
126
                theIndex = 1;