File Exchange

image thumbnail


version (2.67 KB) by Emmanuel Farhi
Create a structure from a string

1 Download

Updated 05 Feb 2019

View License

This function creates a structure from string containing <name> <value> pairs.
Structure member must be separated by ';' or end-of-lines.
The member assignation can be specified with spaces, '=' and ':'

input arguments:
string: string from which the structure should be extracted. It can
also be a file name, which is then read.

output variables:
s: structure which contains the named values

>> str=str2struct('Temperature: 200; RV=3; comment something nice');
str =
Temperature: 200
RV: 3
comment: 'something nice'

Cite As

Emmanuel Farhi (2020). str2struct (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)


updated m-file

return unmodified input when not convertible.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags