Hi,
I have a really large csv file (about 6 millions rows and 30 columns). I want to edit specific columns of this file and save the changes.
I tried creating a tall table from a datastore, extracting and manipulating the relevant columns, and then assigning them into the table. However, when i attemp to write the new tall table, I get the following error:
Error using tall/subsasgn (line 29)
Incompatible tall array arguments. The first dimension in each tall array
must have the same size, or have a size of 1.
that's even though I had no problems editing the table before attempting to write it.
relevant code:
[file,path] = uigetfile('*.csv');
source = [path,file];
ds = datastore(source);
ds.TextscanFormats{1} = '%s';
ds.Delimiter = ',';
tTable = tall(ds);
colX = gather(tTable.colX);
Flag = gather(tTable.Flag);
combinedFlag = colX2flag(Flag,colX);
combinedFlag = tall(combinedFlag);
tTable.colX(:) = combinedFlag;
tTable.colY(:) = combinedFlag;
tTable.colZ(:) = combinedFlag;
write('C:\Users\.......\test_*.csv',tTable);
In addition, if I try to write tTable without any manipulation, it splits the result into many csv files. is there a way to save all the data into just one file?
4 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811075
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811075
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811080
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811080
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811092
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811092
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811095
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/511295-editing-a-tall-table-and-writing-it-into-a-csv-file#comment_811095
Sign in to comment.