I am trying to store the csv file into an array and then compare each cell by storing it in a temp array and extract into a 1d array or a vector in C# -
var lines = file.readalllines(@"data/ap4.csv"); var pddata = new list<string[]>(); using (var stream_r = new streamreader(@ap4.csv)) { string line; while ((line = stream_r.readline()) != null) { string[] row = line.split(','); pddata.add(row); } } int k = 0; string[][] temp = pddata.toarray(); var se_state = new string[2000]; for(int = 1; i< rowlength;i++) { (int j = 1; j< totalcols; j++) { if(temp[i][j] != "0" && temp[i][j] != se_state[k]) { k++; se_state[k] = temp[i][j]; } } }
the error : index outside bounds of array @ if loop , think se_state out of bounds exception. unable check element of temp array array 1-dimensional
Comments
Post a Comment