I have a user-defined object that is failing to save in R2024b,
>> save testsave mgr
Warning: Variable 'mgr' was not saved. For variables larger than 2GB use MAT-file version 7.3 or later.
It is true that mgr is greater than 2GB. However, it belongs to a class with a saveobj() defined, which greatly compresses the size of the saved object. But the saveobj() method is never reached. The save() operation rejects the variable based on its original size, and never calls saveobj().
I think this has got to be a bug. Does anyone know if it has been fixed in more recent Matlab versions?

댓글 수: 1

Stephen23
Stephen23 대략 2시간 전
"The save() operation rejects the variable based on its original size"
Which is exactly what the SAVE documentation refers to: the variable size.
"I think this has got to be a bug."
Why? The SAVE documentation clearly documents the limits of MAT files according to the variable size, not in terms of any (possibly compressed) resulting file size. It is odd to describe something working exactly as documented to be a "bug".

댓글을 달려면 로그인하십시오.

 채택된 답변

dpb
dpb 대략 9시간 전
편집: dpb 대략 9시간 전

0 개 추천

I'd doubt Mathworks thought of that scenario as being a bug.
While it's clumsy, a search of the bugs database for the keyword SAVE didn't uncover anything matching this description for release from R2024b and newer and a search for saveobj had zero hits in R2024b.
My thinking is this is not in the bugs database and would have to be reported as such to make the list.

댓글 수: 4

Matt J
Matt J 대략 2시간 전
이동: Matt J 대략 2시간 전
Does anyone know if it has been fixed in more recent Matlab versions?
I didn't think the R2026z online run engine would let me allocate 2GB, but apparently it did! But it clearly hasn't been fixed :-(
mgr=myclass; mgr.X=rand(16385,16385);
save testfile mgr
Warning: Variable "mgr" was not saved. For variables larger than 2GB use MAT-file version 7.3 or later.
save testfile mgr -v7.3
saveobj called
dpb
dpb 대략 2시간 전
It would have to be considered as an actual bug first before it would/could be "fixed"... <grin>
While this shows the class saveobj function was called, was it successful in creating a workable .mat file and was it created as -v7.3 or did your custom routine override?
Steven Lord
Steven Lord 대략 7시간 전
Have you reported this to the Support staff as an undesirable behavior in save? [If the documentation describes the behavior as expected this isn't technically a bug, but that doesn't necessarily mean the behavior is what users expect or want.]
If you have reported it in the past, you could contact Support to ask them to nominate this issue as a Bug Report. Or if you report it now, you can ask Support to report it to the development staff and nominate it for a Bug Report. Then if it gets published as a Bug Report, you can follow that report and be notified when it changes (usually when it's reported fixed in a new Update or general release.)
dpb
dpb 대략 6시간 전
I can't find anything in the doc that accounts for anything other than the observed behavior of providing the warning message that the variable >2GB wasn't saved.
It seems quite reasonable that SAVE just looks at the footprint of the variable in the workspace and throws up its hands as a behavior; simply nobody ever thought about there being a customized saveobj in a user-written class that compresses on its own and so can get the object in question under the 2GB threshold.
It also seems like an enhancement request or bug report is in order in order to accomodate the case, certainly..

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Results, Reporting, and Test File Management에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

대략 17시간 전

댓글:

dpb
대략 13시간 전

Community Treasure Hunt

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

Start Hunting!

Translated by