From: Shlomi on
"J Luis" <jluis(a)ualg.pt> wrote in message <ef04635.-1(a)webx.raydaftYaTP>...
> Hi,
> I need to write a binary file with the following structure
> int32,int32,int32,int16,int16,int16,int16
> ....
> ....
>
> but fwrite only allows to use one precision type.
>
> How can it be done?
>
> Thanks
> J. Luis

You should use this submition:
http://www.mathworks.com/matlabcentral/fileexchange/2055-uwriteuread

First you write your varibles to a single really large 'uint8' matrix and then you use 'fwrite' with 'uint8' precision once. It runs infinitly faster than a loop.