From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Binary matrix?
Date: Mon, 22 Oct 2012 11:45:08 +0000 (UTC)
Organization: Xoran Technologies
Lines: 14
Message-ID: <k63bk4$s4i$>
References: <k5vp68$h5o$> <k5vuu0$5ua$> <k613c7$3kt$> <k61he8$j5p$> <k62ic0$6in$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1350906308 28818 (22 Oct 2012 11:45:08 GMT)
NNTP-Posting-Date: Mon, 22 Oct 2012 11:45:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:781139

"Chuck37" wrote in message <k62ic0$6in$>...
> > FREAD let's you read from the file with a 'ubitn' precision type. I've never used it, but I'm guessing that let's you read in individual bits. So if you passed a precision argument of 'ubit1=>uint8', that might do what you want.
> Thanks, but then I'd still be using 8x the memory necessary if I stored every bit using 8 bits.  For an image with millions of pixels, this is significant.

Millions of pixels doesn't actually sound all that significant, but regardless, MATLAB gives you no alternative, I'm afraid. It offers no matrix data types that consume less than 1 byte per element. 

Remember what I said, though, about sparse matrices. If your bits are mostly zeros, storing them as type sparse would conserve a lot of memory. 

  help sparse

Or, if they are mostly ones, then not(yourmatrix) would be sparse instead and you could work in terms of that.