Skip to content

Commit

Permalink
allow specifying endianness when loading mch files
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 11, 2015
1 parent a7d64ff commit cb32105
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mmc/trunk/matlab/loadmch.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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 <at> nmr.mgh.harvard.edu)
%
% input:
% 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
Expand All @@ -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=[];
Expand Down

0 comments on commit cb32105

Please sign in to comment.