Repository navigation
Conversation
When saveobj returns something other than an object of its class, MATLAB saves that value in the property any. EnterFieldNameObject and GetFieldValueFromObject also added the class defaults as fields next to any, so reading such an object showed gain 2 from the class defaults next to the saved any.gain 5. Defaults are now skipped when the object uses a valid saveobj property set, the same check that GetPropertySetForObject makes. The test reads test_saveobj_v7.mat and test_saveobj_v73.mat from mat-io (BSD-3-Clause), which need to go into the test datasets. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Test files: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objects whose
saveobjmethod returns something other than an object of their class are read with the class defaults as extra fields next toany, so a program that reads such a field gets the default, not the value saved inany:test_mat readvar test_saveobj_v7.mat obj_saveobjshowsany.gain = 5and next to itgain = 2. MATLAB R2022b and R2026b loadgain = 5.Since my #389 the defaults are read, but they only belong to objects from the normal property region.
EnterFieldNameObjectandGetFieldValueFromObjectnow skip them when the object uses a valid saveobj property set, the same check thatGetPropertySetForObjectmakes. The test usestest_saveobj_v7.matandtest_saveobj_v73.matfrom mat-io (BSD-3-Clause), attached here. Could you add them tomatio_test_datasets? Until then the two new tests fail.AI disclosure: I used Claude Code (Claude Opus 5.5) to find this, write the fix, the test and this description, and Codex (GPT-6 Astra and GPT-6.2 Sol), Claude Code (Claude Fable 5.2) and a second Claude Code (Claude Opus 5.5) session to review them. I understand what the PR does and why. I read and understood it before posting.