%% List Field Names in Cell Array
% Create a structure.

data.x = linspace(0,2*pi);
data.y = sin(data.x);
data.title = 'y = sin(x)'

%
% Order the fields by listing their names in a cell array.

C = {'title','x','y'};
data = orderfields(data,C)

% Copyright 2018 The MathWorks, Inc.