Saving integer as a bit
Mostrar comentarios más antiguos
I have an array which contains only 0s and 1s. Each data pt is getting saved as an 8 bit integer. How do I save it as a bit to save my memory space?
Respuestas (2)
Andrei Bobrov
el 11 de Abr. de 2012
in your case use logical array
a1 = randi([0 1],10));
a2 = logical(a1);
1 comentario
Naved Patanwala
el 11 de Abr. de 2012
Mohammad Reza Naderi
el 29 de Jul. de 2020
0 votos
fwrite(fileID,A,precision,skip) Use fwrite for this work. https://www.mathworks.com/help/matlab/ref/fwrite.html#d120e398961
1 comentario
Mohammad Reza Naderi
el 29 de Jul. de 2020
If you want to save with specific precision use instead of precision ubitn
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!