From cb321056bb725279a74045120025219ac79b152e Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Sat, 11 Apr 2015 09:43:58 -0400 Subject: [PATCH] allow specifying endianness when loading mch files --- mmc/trunk/matlab/loadmch.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mmc/trunk/matlab/loadmch.m b/mmc/trunk/matlab/loadmch.m index 5bdfc963..cd8e5fac 100644 --- a/mmc/trunk/matlab/loadmch.m +++ b/mmc/trunk/matlab/loadmch.m @@ -1,6 +1,6 @@ -function [data, headerstruct, photonseed]=loadmch(fname,format) +function [data, headerstruct, photonseed]=loadmch(fname,format,endian) % -% [data, header]=loadmch(fname,format) +% [data, header]=loadmch(fname,format,endian) % % author: Qianqian Fang (fangq nmr.mgh.harvard.edu) % @@ -8,6 +8,8 @@ % fname: the file name to the output .mch file % format:a string to indicate the format used to save % the .mch file; if omitted, it is set to 'float' +% endian: optional, specifying the endianness of the binary file +% can be either 'ieee-be' or 'ieee-le' (default) % % output: % data: the output detected photon data array @@ -32,7 +34,11 @@ format='float'; end -fid=fopen(fname,'rb'); +if(nargin<3) + endian='ieee-le'; +end + +fid=fopen(fname,'rb',endian); data=[]; header=[];