How to save variables in matlab in most optimal way
32 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Adel Hafri
il 14 Mag 2022
Commentato: Adel Hafri
il 3 Giu 2022
Hello, i have being trying to implement multiple image compression algorithms in matlab (such as RLE) but when encoding an image and trying to save the encoded matrix as a .mat file, it always becomes larger when it should be smaller thoeratically
so i want to know what other ways can you save variables such that it gets the original size it should have
thanks in advace
4 Commenti
dpb
il 14 Mag 2022
Modificato: dpb
il 15 Mag 2022
What's the precison of your raw data? Use the same.
There may be another place where MATLAB is increasing the storage size that you're not expecting -- by default it turns virtually everything numeric into double precision, even image data that may only be 8-bit depth.
We would have to know the details of what you're doing to a much greater depth than you've divulged so far to know anything specific.
Risposta accettata
Walter Roberson
il 15 Mag 2022
fwrite() with the 'bit1' precision.
For compression calculations purposes you should never be using the size of mat files. mat files have overhead for every variable, and mat files have their own compression built in.
7 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Denoising and Compression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!