I have a matrix that is millions of rows long. It's a matrix of only one's and zero's. I want to turn the value type from 64-bit to binary so that I can store even more rows before my computer runs out of memory. How can I do this?
No products are associated with this question.
Basically I want to change each value in the matrix from 8 bytes to 1 bit
Use fwrite in conjunction with fopen/fclose to write the binary file with your data type.
doc fwrite
For more information.
1 Comment
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83759#comment_162515
Why is this bit array store in a 64 bit type? Please post more details, e.g. if it is signed or unsigned, if the neighboring bits are sorted columnwise or rowwise, If the number of rows or columns is a multiple of 8, if you want to modify the resulting array afterwards, etc.
Most likely it is a bad idea to store the bits in such a huge type, instead of choosing a bit-representation directly.