Last active
August 27, 2015 23:03
-
-
Save welch/2931132e66c0e2cdb364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pairs = readzmax(FileName) | |
fileID = fopen(FileName); | |
% read the file data | |
vals = fileread(FileName); | |
fclose(fileID); | |
% Convert to string | |
dstr = sprintf('%s',vals); | |
% keep only lens data | |
GLDstart = regexp(dstr, 'GENEARL LENS DATA:','end'); | |
dstr = dstr(GLDstart+2:end); | |
Fieldstart = regexp(dstr, 'Fields','start'); | |
dstr = dstr(1:Fieldstart-2); | |
lines = regexp(dstr, '\n', 'split'); | |
% parse the lines into name/value | |
pairs = regexp(lines, '(?<name>[^:]*):\s*(?<value>\S*)', 'names'); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment