Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Binary matrix?

$
0
0
"Matt J" wrote in message <k61he8$j5p$1@newscl01ah.mathworks.com>...
> "Chuck37" wrote in message <k613c7$3kt$1@newscl01ah.mathworks.com>...
> > Each element is a single bit. If I keep each element as uint8, I waste a lot of memory. I was only suggesting I could possibly read the file in as a stream of uint8, but then I'd have to index it, i.e. figure out which uint8 to use, then extract a particular bit from that uint8. If I could directly index B(x,y) and get binary/boolean results without wasting memory, that would be better.
> =============
>
> 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.

Viewing all articles
Browse latest Browse all 19628

Trending Articles