Deconstruct values (like a zipcode) into individual segments

Version 1.0.0 (1.62 KB) by Jeff Burkey
This function will extract out each digit (as defined by the user) from a value for further use. For example, like a zip code or HRU.
0 Downloads
Updated 25 Nov 2025

View License

Deconstructs values into discrete digits for attributes
This function will deconstruct a value (like a zipcode). Each digit in the
value has a specific meaning. This function will parse out each segment
(can be 1 or more digits for a given segment) to an array of
segments (digits) generated from each value (e.g., zipcode).
The function assumes all entered values have the same structure of digits
describing the decimal place.
example input:
a = [22115200; 20138285; 8130688];
b = [2,1,1,3,1]
NOTE: b must be a valid array for all values input in 'a'
example output is:
f= [22 1 1 520 0;20 1 3 828 5;8 1 3 68 8];
There might be a more elegant way to use a more sophisticated approach,
but it gets the job done and does not use loops.
Nov 25, 2025- J. Burkey

Cite As

Jeff Burkey (2025). Deconstruct values (like a zipcode) into individual segments (https://se.mathworks.com/matlabcentral/fileexchange/182679-deconstruct-values-like-a-zipcode-into-individual-segments), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0