From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Binary matrix?
Date: Sun, 21 Oct 2012 15:12:07 +0000 (UTC)
Organization: Rincon Research Corp
Lines: 10
Message-ID: <k613c7$3kt$>
References: <k5vp68$h5o$> <k5vuu0$5ua$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1350832327 3741 (21 Oct 2012 15:12:07 GMT)
NNTP-Posting-Date: Sun, 21 Oct 2012 15:12:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2235717
Xref: comp.soft-sys.matlab:781098

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.

"Matt J" wrote in message <k5vuu0$5ua$>...
> "Chuck37" wrote in message <k5vp68$h5o$>...
> > I'm looking for suggestions on how to work with a 2D array of binary values.  I have the data in a file, but I'd like to have a 2D matrix of binaries that I can look up values in.  The matrix size is way too big to just let the binaries be wastefully stored as doubles.  I could read the file in as characters or uint8 or something, but then I'd need to figure out how to index into this.  Is there an easier way?
> ===========
> I'm not sure what you think is more difficult about indexing a uint8 matrix than a double matrix. It's exactly the same.
> BTW, once you've read in to a uint8 matrix, it would probably be appropriate to convert it to type logical. Also, be aware that sparse matrices can hold type logical, if that's applicable to you.