% cs3113f08HW02P02.m
% K. Ming Leung, September 21, 2008
% 10 pts total

clear;
NAMES = [   'Damon    '; 
            'Jeter    ';
            'Abreu    ';
            'Rodriguez';
            'Giambi   ';
            'Nady     ';
            'Cano     ';
            'Ransom   ';
            'Betemit  ';
            'Molina   '];
Ages = [ 36; 32; 29; 28; 35; 25; 24; 21; 23; 26],
Handiness = [ 'R'; 'R'; 'L'; 'R'; 'L'; 'L'; 'R';'L'; 'R'; 'R'],
% 1 pt for creating the above matrices
numberPlayers = length(Ages);

LogicVec = [ (Ages > 30 | Ages < 25) & Handiness == 'R' ],  % 5 pts
Index = find(LogicVec);         % 2 pts

Blanks0(1:numberPlayers,1) = ' ';

Blanks1(1:length(Index),1) = ' ';


% using actual indexing for the names
[ num2str(Index) Blanks1 NAMES(Index,:) ]       % 2 pts

% or using logical indexing for the names
[ num2str(Index) Blanks1 NAMES(LogicVec,:) ]    % same

% The entire list of players in their batting order: (no need to do)
[ num2str((1:numberPlayers)') Blanks0 NAMES Blanks0 ...
  num2str(Ages) Blanks0 Handiness ]
