MATLAB: Changing the color of stacking bar plot with many groups

bar

I have a big matrix with size of 28 X 10 and I used bar plot (stacking) to plot them. Now I'm struggling to change the color for all the 28 variables. Any to make them look different so i cant distinguish them.
figure
students = rand(28,10);
year = 2020: 2029;
bar(year, students, 'stacked')
legend('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'Z')

Best Answer

students = rand(28,10);
year = 2020: 2029;
h=bar(year, students, 'stacked') ;
legend('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'Z')
c=colormap('jet');
pick=round(linspace(1,size(c,1),numel(h)));
c=mat2cell(c(pick,:),ones(1,numel(h)),3);
[h.FaceColor]=deal(c{:});