Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

plot textdata on the x axis and number data on the y axis

Asked by Clifford Shelton on 25 Apr 2012

I am a ultra beginner at Matlab..so I'm constantly frustrated with problems. I have a time series data set that I imported from a .csv spreadsheet. When importing the data MATLAB then proceeded to split the data between 'textdata' and 'data'

The data set is the game history of a baseball team. Therefore the 'textdata' that has been separated is the text infromation consisting of the date of the game (4/12/2012), name of opponent (NYM) etc. The other non text data is all numbers.

How do i plot the textdata on the x axis (date of game) and the score on the y axis??? I think I'm supposed to convert the text data into an array or something...but I have NO clue how!

Please be very detailed in any answers you are so kind to give. I am an ULTRA beginner. Thanks!!

0 Comments

Clifford Shelton

Products

No products are associated with this question.

5 Answers

Answer by Thomas on 25 Apr 2012
Accepted answer

Convert your date array into a number using datenum

doc datenum

and then plot it using the plot command, and use 'datetick' to get it back on the x-axis..

or if you donot want to convert to datenum just plot the scores and use the Xtick labels to show what date and team the value corresponds to..

It would easier to help if we can see what you have done so far and where you are getting stuck..

0 Comments

Thomas
Answer by Walter Roberson on 25 Apr 2012

At the command line give the command

doc axes_props

and look down near the bottom of the help information to read about XTickLabel

0 Comments

Walter Roberson
Answer by Clifford Shelton on 28 Apr 2012

Thanks for all the help! I'm still having trouble with it..but I'll get there sure 'nuff!

0 Comments

Clifford Shelton
Answer by Fredrik Behrendtz on 5 Jun 2012

Good thread, I will continue on this with one further question.

DATENUM converts the date string to a double holding time info, DATETICK replace this number into desired time format for the X-axis.

Well, is there any way to also get date and time in the "hoover box" which apperas when you choose a point with "data cursor". The hoover box includes the datenum number which is hard to read. /Thanks

0 Comments

Fredrik Behrendtz
Answer by Fredrik Behrendtz on 5 Jun 2012

I found out how to do! I just right clicked the textbox and edited the desired function :)

0 Comments

Fredrik Behrendtz

Contact us