error reading csv file
1 view (last 30 days)
Show older comments
I'm trying to run a script called main_v1 which calls up function E1_v2 that reads a file called 'MH.csv.' That file is attached. This same script ran with the exact same file on a Macintosh a few years ago (now using Windows, but I thought I made all the changes needed for it to run on Windows). Thanks for any input!
>> main_v1
Index exceeds the number of array elements. Index must not exceed 0.
Error in load_E1_v2 (line 27)
sub(sn).expt_name = data{1}{ind(1)};
Error in main_v1 (line 41)
sub = load_E1_v2([datadir 'MH.csv']);
1 Comment
Walter Roberson
on 9 Feb 2023
Difficult to say without the code.
We also do not know if it is data that is empty or if it is ind that is empty
Answers (2)
Mathieu NOE
on 10 Feb 2023
hello
readtable reads your file without any issue
you may have to do a bit of code updating
T = readtable('MH.csv');
T =
3770×6 table
Var1 Var2 Var3 Var4 Var5 Var6
____________________ ______ ___________ __________ ___________ __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
{'TDadolescents,EE'} {'EE'} 02-Mar-2018 1.6342e+05 02-Mar-2018 {'2662A.mat,2.000000,1.000000,1.000000,10.000000,1.000000,60.000000,64.000000,NaN,NaN,63.000000,55.000000,58.000000,53.000000,52.000000,67.000000,73.000000,68.000000,50.000000,53.000000,2.000000,1.000000,1.000000,1.000000,2.000000,2.000000,1.000000,2.000000,1.000000,1.000000,1.462309,0.882061,0.779916,0.584473,1.867812,2.183826,1.854120,2.065854,1.150444,0.936066' }
{'TDadolescents,EE'} {'EE'} 02-Mar-2018 1.6342e+05 02-Mar-2018 {'2662A.mat,2.000000,1.000000,2.000000,10.000000,1.000000,60.000000,90.000000,NaN,NaN,67.000000,49.000000,88.000000,53.000000,90.000000,64.000000,97.000000,99.000000,94.000000,88.000000,1.000000,1.000000,2.000000,1.000000,2.000000,1.000000,2.000000,2.000000,2.000000,2.000000,1.541691,0.673007,0.450677,0.473170,1.645629,1.268664,0.777795,0.643609,0.579070,0.446106' }
{'TDadolescents,EE'} {'EE'} 02-Mar-2018 1.6342e+05 02-Mar-2018 {'2662A.mat,2.000000,1.000000,3.000000,10.000000,1.000000,30.000000,60.000000,NaN,NaN,56.000000,22.000000,38.000000,32.000000,54.000000,51.000000,58.000000,58.000000,72.000000,58.000000,2.000000,1.000000,1.000000,1.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,0.599182,0.248980,0.349369,0.390607,0.453135,0.814063,0.516898,0.279699,0.596531,0.307037' }
{'TDadolescents,EE'} {'EE'} 02-Mar-2018 1.6342e+05 02-Mar-2018 {'2662A.mat,2.000000,1.000000,4.000000,10.000000,1.000000,68.000000,60.000000,NaN,NaN,81.000000,78.000000,66.000000,56.000000,64.000000,67.000000,36.000000,66.000000,72.000000,71.000000,1.000000,1.000000,1.000000,2.000000,1.000000,1.000000,2.000000,1.000000,1.000000,1.000000,2.208260,0.447568,0.298248,0.438946,1.490592,0.414082,0.727076,0.240622,0.369303,0.282166' }
{'TDadolescents,EE'} {'EE'} 02-Mar-2018 1.6342e+05 02-Mar-2018 {'2662A.mat,2.000000,1.000000,5.000000,10.000000,1.000000,40.000000,52.000000,NaN,NaN,54.000000,40.000000,41.000000,27.000000,68.000000,34.000000,70.000000,55.000000,60.000000,39.000000,2.000000,1.000000,1.000000,1.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,0.777572,0.245427,0.278599,0.406819,1.601301,0.456901,0.637799,0.268184,0.246351,0.246957' }
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!