Structure filed decapsulator
Version 1.0.1 (1.36 KB) by
Jungmin kim
This function creates variables in the workspace for each struct field with the field's name & value
This function creates a variable in the executed workspace for each of the fields in the struct with the name and value of each field. It's intended to run in a local function, but it can also work elsewhere, probably.
This function only works when executed in the following manner:
function xxx = yyy(zzz)
evalComment = decapsulator(config,'config',0); % 0 is not vorbose, 1 is verbose at command line
eval(evalComment);
%%% You can play every val in the structure !!!
end
The idea of this function is to create an evalComment when varnargin is 3, and a function that is executed by eval when varargin is 4.
Good luck, commander !
Cite As
Jungmin kim (2024). Structure filed decapsulator (https://www.mathworks.com/matlabcentral/fileexchange/162046-structure-filed-decapsulator), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2024a
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.