From a4009b64c3220a671f3c860d8e92164925bff810 Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Wed, 23 Oct 2024 00:31:02 -0400 Subject: [PATCH] [octave] workaround for octave bug https://savannah.gnu.org/bugs/?66161 --- loadbidstsv.m | 2 +- readasc.m | 2 +- readgts.m | 2 +- readmedit.m | 2 +- readnirfast.m | 4 ++-- readsmf.m | 2 +- readtetgen.m | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/loadbidstsv.m b/loadbidstsv.m index 4e9487f..bc3fe6d 100644 --- a/loadbidstsv.m +++ b/loadbidstsv.m @@ -46,7 +46,7 @@ fid = fid((endpos + 1):end); end else - fid = fopen(tsvfile, 'rt'); + fid = fopen(tsvfile, 'rb'); header = fgetl(fid); header = regexprep(header, '\s*$', ''); end diff --git a/readasc.m b/readasc.m index 484afa7..2003102 100644 --- a/readasc.m +++ b/readasc.m @@ -19,7 +19,7 @@ node = []; elem = []; -fid = fopen(fname, 'rt'); +fid = fopen(fname, 'rb'); if (fid == -1) error(['can not read file ' fname]); end diff --git a/readgts.m b/readgts.m index fb1b9d8..cf66e21 100644 --- a/readgts.m +++ b/readgts.m @@ -22,7 +22,7 @@ node = []; elem = []; -fid = fopen(fname, 'rt'); +fid = fopen(fname, 'rb'); line = fgetl(fid); dim = sscanf(line, '%d', 3); node = fscanf(fid, '%f', [3, dim(1)])'; diff --git a/readmedit.m b/readmedit.m index cfffbf0..04997c8 100644 --- a/readmedit.m +++ b/readmedit.m @@ -20,7 +20,7 @@ node = []; elem = []; face = []; -fid = fopen(filename, 'rt'); +fid = fopen(filename, 'rb'); while (~feof(fid)) key = fscanf(fid, '%s', 1); if (strcmp(key, 'End')) diff --git a/readnirfast.m b/readnirfast.m index cd8ac6e..d6c8cb7 100644 --- a/readnirfast.m +++ b/readnirfast.m @@ -58,7 +58,7 @@ end fname = [filestub, '.excoef']; -fid = fopen(fname, 'rt'); +fid = fopen(fname, 'rb'); if (fid >= 0) linenum = 0; textheader = {}; @@ -82,7 +82,7 @@ end fname = [filestub, '.param']; -fid = fopen(fname, 'rt'); +fid = fopen(fname, 'rb'); if (fid >= 0) linenum = 0; params = []; diff --git a/readsmf.m b/readsmf.m index 84a626a..456bbbb 100644 --- a/readsmf.m +++ b/readsmf.m @@ -18,7 +18,7 @@ % node = []; elem = []; -fid = fopen(fname, 'rt'); +fid = fopen(fname, 'rb'); while (~feof(fid)) line = fgetl(fid); if (line(1) == 'v') diff --git a/readtetgen.m b/readtetgen.m index 62cdd2c..aa876f6 100644 --- a/readtetgen.m +++ b/readtetgen.m @@ -19,7 +19,7 @@ % % read node file -fp = fopen([fstub, '.node'], 'rt'); +fp = fopen([fstub, '.node'], 'rb'); if (fp == 0) error('node file is missing!'); end @@ -33,7 +33,7 @@ fclose(fp); % read element file -fp = fopen([fstub, '.ele'], 'rt'); +fp = fopen([fstub, '.ele'], 'rb'); if (fp == 0) error('elem file is missing!'); end @@ -48,7 +48,7 @@ fclose(fp); % read surface mesh file -fp = fopen([fstub, '.face'], 'rt'); +fp = fopen([fstub, '.face'], 'rb'); if (fp == 0) error('surface data file is missing!'); end