Converting from comma delimiter to semicolon

48 views (last 30 days)
Klark Ahmeti
Klark Ahmeti on 15 Jun 2022
Answered: Voss on 15 Jun 2022
I am reading a semicolon-delimited CSV file and after selecting rows I need to save these in another semicolon-delimited file, but MATLAB saves them using comma as a delimiter. Is there any workaround to this ?
GinestousPres = readtable("GinestousPres.csv");
idx = (GinestousPres.Date >="27/08/2021") & (GinestousPres.Date<"30/10/2021");
T = GinestousPres(idx,:);
%Write it in a ; separated file
results = GinestousFinal();

Answers (1)

Voss
Voss on 15 Jun 2022
type test.csv % initial comma-delimited file
won,to,tree 1,2,-99 3,4,-2
T = readtable('test.csv'); % read to table
writetable(T,'test_semi.csv','Delimiter',';'); % write table with semicolon delimiter
type test_semi.csv % final semicolon-delimited file
won;to;tree 1;2;-99 3;4;-2

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!