quickly put/update all variables into/in a structure

版本 1.0.0 (1.3 KB) 作者: Zhuoqun Zhang
very tiny function, nothing too serious. I share this one as I thought it may helpful for people who like tidy code
4.0 次下载
更新时间 2020/7/3

查看许可证

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)

引用格式

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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2020a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0