I am trying to read a csv file into Matlab using the following command
data=csvread('/econ/research/rd123/RAIS/Chuhang/data/final_samples/growth_regs_RandI_ALL.csv',1,0);
But matlab produced the following message:
{Error using dlmread (line 138) Mismatch between file and format string. Trouble reading 'Numeric' field from file (row number 1, field number 1) ==> "00000000000272",440,"65","13007",1995,6586,.1776316,-.1045213,.2821529,.0000105,.0002363,.0378644,.0078976\n
Error in csvread (line 47) m=dlmread(filename, ',', r, c);
Error in import_all_mfn (line 13) data=csvread('/econ/research/rd123/RAIS/Chuhang/data/final_samples/growth_regs_RandI_ALL.csv',1,0);
Does anyone know what the problem might be? Thanks in advance!
-Chuhang
Use
T = readtable(filename);
firstcolumn = T{:,1};
This function reads all table but you must use indices as cells.
Also there is an explanation here. https://uk.mathworks.com/help/matlab/ref/readtable.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With