MATLAB: CSVread / dlmread not working when trying to upload a CSV file


Hi all,
I cannot upload my CSV file into matlab no matter what I try. I have attached both the CSV and Xlsx file and just want to upload the numbers. There are titles at the top of each column – I know that people keep saying it only likes numbers and not text but reading the documentation, from 2015 (I have 2019) you CAN have csv files with words in and can ignore them especially if they are on the top row.
I have tried every command I can, here are the main ones:
>> M = csvread('WPrimedatacsvtitle.csv',R1,C0) %meant to be skip out row one only
Undefined function or variable 'R1'.
Did you mean:
>> M = dlmread('WPrimedatacsvtitle.csv',',',R1,C1) %why not try C0 too
Undefined function or variable 'R1'.
any help would be greatly appreciated.

Best Answer

  • The csvread documentation explains that the 2nd, 3rd, 4th and 5th input arguments are an offset value, and that they must be specified as positive integers.
    You have apparently tried to provide Excel-style cell references without any string qualifiers, which means they get interpreted as attempts to refer to some variables or functions of those names... which would be perfectly valid if you actually had variables or functions defined with those names. But as the error message makes quite clear, you don't.
    In any case, it is simple to just provide integers, exactly as the documentation specifies:
    M = csvread('WPrimedatacsvtitle.csv',1,0)
    % ^ ^ integers