How to plot a text data column from an excel file in MATLAB?

Discussion in 'Programmer's Corner' started by SarahQ, Dec 6, 2013.

  1. SarahQ

    Thread Starter New Member

    Dec 6, 2013
    Hello, I have imported in Matlab an excel file that contains two columns, one with numeric values, and the other one with text values. The first 5 rows can be seen below:

    ABF-E 0.34

    HJK-D -0.54

    GHKL-I 1.34

    FPLO-5 2.3

    KKJLL-T 0.98

    I need to plot the numeric column on the Y axis and the text column on the X axis. I can easily work with the numeric column using xlsread and plot, but I can not manage plotting the text column. How could I do it?.

    I have written the following code, but I don't know what to do for the x Axis:

    filename = 'MyData.xlsx';

    Sheet = 2

    xlRange = 'B1:B60';

    Yaxis = xlsread (filename,Sheet,xlRange);

    Xaxis = ????????;


    I would be very grateful if somebody could help me.
  2. MrChips


    Oct 2, 2009
    Get the data into a cell array

    and then use

    SarahQ likes this.