Can I save a model using saveLearnerForCoder that is larger than 2GB

7 views (last 30 days)
I am currently training several regression models that are quite large. To save time on retraining if something were to happen, I've been trying to use saveLearnerForCoder; however, I keep getting the error "Warning: Variable 'compactStruct' was not saved. For variables larger than 2GB use MAT-file version 7.3 or later." but when I try to use the '-v7.3' tag, it says it's too many input variables.
Is there a way to work around the file size/use a different function to save the full model when it is large? Regular save() also does not seem to work because it loads in an empty struct. Thanks!

Answers (1)

arushi
arushi on 4 Jul 2024
Hi Savannah,
I understand from your query that you want to save variables larger than 2GB. For this, you can use the '-v7.3' flag with the 'save' function. Here is an example of how to use it:
save('model.mat', 'var', '-v7.3');
In '-v7.3', the variables are saved with compression by default. If you do not want this behavior, you can use the '-nocompression' flag.
You can refer to the documentation on version flag for more information:
Hope this helps!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!