Answer MATLAB Bitstream Question | Fast Solution

  • Context: MATLAB 
  • Thread starter Thread starter shekoofy
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion centers on optimizing memory usage in MATLAB when handling long bitstreams. Users can utilize the uint8 or single data types to reduce the memory footprint of individual elements in an array, rather than using the default double type. Additionally, employing uint64 along with bit-level operators such as bitset and bitget can further enhance efficiency. The consensus is that while packing bits into doubles is possible, it is often unnecessary due to the availability of ample virtual memory.

PREREQUISITES
  • Familiarity with MATLAB programming and m-files
  • Understanding of data types in MATLAB, specifically uint8, single, and uint64
  • Knowledge of bit-level operations, including bitset and bitget
  • Basic concepts of memory management in programming
NEXT STEPS
  • Explore MATLAB documentation on uint8 and single data types
  • Learn how to implement bitset and bitget functions in MATLAB
  • Research best practices for memory optimization in MATLAB applications
  • Investigate alternative data structures for handling large datasets in MATLAB
USEFUL FOR

MATLAB developers, data scientists, and engineers looking to optimize memory usage when processing large bitstreams in their applications.

shekoofy
Messages
4
Reaction score
0
matlab easy question!

hi,
I,ve recently wrote a m-file in MATLAB which generates a kind of long bitstream,science it is a long stream i wonder if there is any pisibility that i could put them in a form that each bit occupies
exactly one bit rather than a double in workspace.
thank u all
 
Physics news on Phys.org


shekoofy said:
hi,
I,ve recently wrote a m-file in MATLAB which generates a kind of long bitstream,science it is a long stream i wonder if there is any pisibility that i could put them in a form that each bit occupies
exactly one bit rather than a double in workspace.

Yes, you could use one of the longer integer data types and bit-level operators. Try:

help uint64
help bitset
help bitget




-Will Dwinnell
http://matlabdatamining.blogspot.com/"
 
Last edited by a moderator:

Similar threads

  • · Replies 7 ·
Replies
7
Views
13K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
4
Views
16K
Replies
17
Views
6K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 39 ·
2
Replies
39
Views
11K
  • Poll Poll
  • · Replies 12 ·
Replies
12
Views
3K