struct2double

Converts a structure into a double format.

You are now following this Submission

Converts a structure into a double matrix.
[out]=struct2double(in) creates out(A,B,C) where [A,B]=size(in) and
fn=fieldnames(in) C=length(fn)

fields must be doubles and not structures

[out]=struct2double(in,field) creates out(A,B,C) where [A,B]=size(in) and
for the given fieldname 'field'.

Cite As

Clayton (2026). struct2double (https://se.mathworks.com/matlabcentral/fileexchange/42981-struct2double), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.3.0.0

It should do the overall structure into a matrix better. If the fields are not the same dimensions than nans will be used to fill. Currently only handles a MxN for the structure and a 3D matrix for each field, but this can easily be adjusted.

1.2.0.0

added a squeeze function at the end to bring it to the smallest dimensions.

1.1.0.0

edited indexes for the chosen fieldname

1.0.0.0