Maybe a is not the whole file, try
a=fread(fid,'int16',inf);
----- Original Message -----
From: "Sun, Chen-Ming" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Wednesday, November 27, 2002 3:47 PM
Subject: matlab fwrite function resulting analyze img file byte loss
> Dear SPMers:
> I use matlab R12 on windows 2ooo, to read an
> analyze format image (xxx.img)and the to write
> the image to yyy.img:
> -------------------
> fid=fopen('xxx.img');
> a=fread(fid,'int16');
> ------------------------
> fid=fopen('yyy.img','w');
> b=fwrite(fid,a,'int16');
> ----------------------
> The resulting yyy.img is several hundred
> bytes less than the original xxx.img.
> Thank any one who can help.
>
>
> Sun, Chen-Ming
> 2002/11/27
>
>
> =====
> sunchenming
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
|