Thread Subject: plotting line graphs; how to read certain game names?

Subject: plotting line graphs; how to read certain game names?

From: rohan patel

Date: 22 Nov, 2009 17:09:04

Message: 1 of 1

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

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com