% Script/Function Filename:
%     updateRadius.m
% Purpose:
%     Enter the purpose of the function/file here
%     
% Record of modifications:
%     Programmer(s): {Your Name}
%     Date Due: YYYY-MM-DD
%     Date Submitted: YYYY-MM-DD
%     References: ????
%     Help Received: ????
%     
% Variables Used:
%     Enter the variables that you use here
function [] = updateRadius( source , ~ )
data = get( 1 , 'UserData' );
height = data{ 1 };
ourAxes = data{ 3 };
radius = get( source , 'value' );
set( 1 , 'UserData' , { height , radius , ourAxes } );
[ X , Y , Z ] = cylinder( 1 , 1000 );
X = X * radius;
Y = Y * radius;
Z = Z * height;
surf( X , Y , Z , 'EdgeColor' , [ 0 0 1 ] , 'FaceColor' , [ 0 0 1 ] );
t = linspace( 0 , 2 * pi , 999 );
t = [ t 0 ];
x = radius * cos( t );
y = radius * sin( t );
patch( x , y , zeros( size( x ) ) , 'b' );
patch( x , y , ones( size( x ) ) * height , 'b' );
[ volume , surfaceArea ] = cylinderInfo( height , radius );

set( 1 , 'NumberTitle' , 'off' );
set( 1 , 'Name' , sprintf( ...
    'Height: %.2f Radius: %.2f Volume: %.2f Surface Area: %.2f' , ...
    height , radius , volume , surfaceArea ) );
end