Search code examples
matlabmatlab-figure

Plotting a csv file?


I have a file csv file, in this file how I can plot D18:D10000 versus E18:E10000; I used [v,t]= scop('H.csv') with considering following function but did not work:

function [v,t]=scope( filename )
    v=xlsread(filename,'','E18:E10000');
    t=xlsread(filename,'','D18:D10000');
    plot(t,v)

Solution

  • You need to specify the sheet (second argument) by either name or number:

    xlsread(filename,'Sheet1','E18:E10000');
    

    or

    xlsread(filename,1,'E18:E10000');
    

    Note the apostrophes!

    Also xlsread has up to 3 output arguments:

    [Num, Txt, Raw] = xlsread(...)
    

    You may need to use the Raw output if your data contains both text and nums.

    Try

    help xlsread