quickly put/update all variables into/in a structure
Version 1.0.0 (1.28 KB) by
Zhuoqun Zhang
very tiny function, nothing too serious. I share this one as I thought it may helpful for people who like tidy code
default way to do this task is tedious and inflexible
e.g.: s = struct('a',{},'b',{},'c',{})
this simple function can make it better
e.g. s = updateStruct(s, a,b,c)
This function can be used to add/update the existed fields of a structure
OR
directly generate a new structure with given variables as fields.
e.g. s1 = updateStruct( [ ], a,b,c)
Cite As
Zhuoqun Zhang (2024). quickly put/update all variables into/in a structure (https://www.mathworks.com/matlabcentral/fileexchange/77738-quickly-put-update-all-variables-into-in-a-structure), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2020a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |