%% Store Related Data Variables in Structure
% Store related pieces of data in the fields of a structure. You can give the fields human-readable names that describe the data.
% Create a structure by adding fields to it using dot notation. The fields contain x- and y-values for a sine wave, and text that describes the data.

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

%
% Plot the sine wave. You can refer to the arrays of x- and y-values by their field names. Then add the title.

plot(data.x,data.y)
title(data.title)

% Copyright 2012 The MathWorks, Inc.