|
I have to xlsread information about game data (units sold per month) from an excel sheet. I have to make an line graph showing monthly sales for up to six games. Each games line must be drawn with different color, marker, etc. My problem is how do i do it where it can graph more than two games without crashing. The following code i wrote can only calculate 'iKitty' and 'shootEmUp'. I need it to where when i add games in the excel file, Matlab will read the excel file and only plot the games i added ( they can be 3 games or even 5 games but no more than six).
'Game' 'January' 'February' 'March' 'April' 'May' 'June'
'iKitty' 75 254 1235 1820 2114 1600
'ShootEmUp' 3584 4588 9421 10588 12788 16889
[gamesNumber gamesText] = xlsread('data.xls')
gamesNumbersYAxis = gamesNumber(:,1:6)
gamesMonthXAxis = [1 2 3 4 5 6]
figure(1)
hold on
plot1 = plot(gamesMonthXAxis, gamesNumbersYAxis(1,:), 'r:*')% ikitty units game
hold on
plot2 = plot(gamesMonthXAxis, gamesNumbersYAxis(2,:), 'c-<') % shootemup game
hold off
plot3 = plot(gamesMonthXAxis, gamesNumbersYAxis(3,:), 'g--+') %(game to be added, matlab crashs here because i do not have an game for this)
hold on
plot4 = plot(gamesMonthXAxis, gamesNumbersYAxis(4,:), 'k-.o')
hold on
plot5 = plot(gamesMonthXAxis, gamesNumbersYAxis(5,:), 'b-.s')
hold on
plot6 = plot(gamesMonthXAxis, gamesNumbersYAxis(6,:), 'm:h')
hold off
|