Modified Signal Logging file size gets very large

3 views (last 30 days)
I have a singnal logging file generrated from a model that is about 2800 KB. I have a script that trims off the first 1 second of data to strip out iniitialization anomolies I do not care about. I also modified the data downsampling from 10 msec to 40 msec samples. When the script is complete the mat file is anywhere from 25,000, to 30,000 KB. Thsi makes the file much less shareable/portable. It would be nice to understand why the file sized increased so much and if there are any tricks?
Thanks,
Will

Answers (1)

Dhruv
Dhruv on 31 Aug 2023
The issue of file size being increased so much is essentially because of duplication of the data. When you trim off the first 1 second of data, it’s still getting stored but just not getting included in the final file. And when you downsample the data, you are storing the same data points, just less frequently.
There are a few tricks you can use to reduce the file size:
  • Only store the data that you need. If you don't need the first 1 second of data, don't store it. And if you don't need the data at 10 msec resolution, downsample it to a lower resolution.
  • Use a lossless compression format. There are several lossless compression formats available, such as GZIP and BZIP2. These formats can significantly reduce the file size without losing any data.
  • Use a smaller data type. If the data is floating point, you can use a smaller data type, such as half precision. This will reduce the file size by half.
Hopefully the above steps will help you solve the issue!

Categories

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!