% recording and visualization of student grades

echo on;

% create cell array of names and convert to structure
names = {'Riemann', 'Gauss', 'Jordan', 'Euler', ... 
   'Hilbert', 'Cauchy', 'Green', 'Stokes', ... 
   'Newton', 'Kolmogoroff', 'Hardy', 'Abel', ... 
   'Banach', 'Schauder', 'Toeplitz', 'Fourier', ... 
   'Laplace', 'Poisson', 'Runge', 'Hermite', ... 
   'Jacobi', 'Stirling', 'Poincare', 'Euclid'};

students = cell2struct(names, 'name', 1), 
pause;

% add name and sort alphabetical
students(end+1).name = 'Thales'; 
[names, ind] = sort({students.name}); 
students = students(ind); 
{students.name}', 
pause;

% assign random grades shown in a histogram
for k=1:length(students); 
   students(k).points = 1+fix(6*rand(1)); 
end; 
hist([students.points],1:6);
pause;

echo off; 

