MATLAB Answers

create multiple mat files for storing data

1 view (last 30 days)
Ricky on 11 Jul 2013
Hello Everyone,
I am reading in data from a device and want to store it in a mat file. Currently I am directly storing my readings in a mat file using save command. I want to store these readings in multiple mat files for operational efficiency.
So for example I have 100 readings I want to create 10 mat files where each mat file contains 10 readings.
Ricky on 11 Jul 2013
Sorry for the vague question actually my problem is I am saving cell arrays in my mat file. So my code reads the raw data from binary file saves that in a cell array and stores that cell array in mat file. I have predefined the size of cell array in which raw data is being parsed. While saving this data in mat file my MATLAB becomes very slow and I run into out of memory. So my idea was to create multiple mat files so that I can solve memory problem as I will be using less virutal memory. I am not sure if this the correct approach.

Sign in to comment.

Accepted Answer

Titus Edelhofer
Titus Edelhofer on 11 Jul 2013
Hi Ricky,
instead of creating multiple .mat files you might try to create one .mat file and access variables in there in parts (using the matfile object).
doc matfile
  1 Comment
Ricky on 11 Jul 2013
Hi Titus,
Actually the problem was that I was parsing my one row of input data and storing it. Then parsing the second row and storing it. This was causing this memory problems in MATLAB.
I have another question regarding out of memory error but I will ask in other thread.
Thanks for your time.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by