pack command with saving v7.3

4 Ansichten (letzte 30 Tage)
Abhejit Rajagopal
Abhejit Rajagopal am 16 Dez. 2015
Hi,
I have an issue with the pack command. I am reading a very large (.dat) file (3GB in size), and cataloging entries from it. I am able to read this file into Matlab, access the stored variable, and query all entries.
In each loop iteration, I am reading and parsing rows of the variable. Every so often, I save the current index (and some minor information, not totalling 3KB), clear the current variables, and continue. The current variables that are cleared are a subset of the large .dat file from which I was reading.
I found out there is an issue with Matlab freeing previously allocated memory ( link ), so I am attempting to use the pack command. However, I get this error when saving the (.dat) file:
>> pack
Warning: Variable 'gt' cannot be saved to a MAT-file whose version is older
than 7.3.
To save this variable, use the -v7.3 switch.
Skipping...
I need this variable, but I could not figure out how to call pack with the -v7.3 flag, as when calling save ( link2 ). I tried this:
>> pack('-v7.3');
Error using save
Unknown command option.
and this:
>> pack('testtmp.mat','-v7.3');
Error using pack
Too many input arguments.
Any ideas?
Thanks in advance.
  1 Kommentar
Philip Borghesani
Philip Borghesani am 18 Dez. 2015
When using 64 bit MATLAB I expect there is little benefit to calling pack. Much of the information in the link you quoted is misleading or does not apply to 64 bit MATLAB. If you have a memory related problem I suggest you post a new question with information about your real problem and look for a solution.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Tushar Sinha
Tushar Sinha am 18 Dez. 2015
Hi Abhejit,
This is a known issue in MATLAB. The 'pack' command cannot save variables that are larger than 2GB in size, and as a result, those variables are lost.
The workaround for this issue is to save the workspace using the 'save' command with the '-v7.3' option, then execute 'pack', then load the saved data. For example:
>> save('data.dat', '-v7.3')
>> pack
>> load('data.dat')
I hope this resolves the issue.
Thanks,
Tushar

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by