How to make a .csv file with data values in .txt
Mostrar comentarios más antiguos
Hallo,
I have a data .txt file with values as below,
0.000000e+00 0.000000e+00
1.005346e-04 1.842308e-20
2.006482e-04 6.750698e-20
3.000943e-04 3.313659e-19
4.002079e-04 6.749189e-19
5.003215e-04 1.001656e-18
6.004351e-04 1.332393e-18
7.005486e-04 1.622378e-18
8.006612e-04 3.978657e+01
9.001020e-04 2.101415e+03
1.000211e-03 5.359804e+03
1.100320e-03 8.372647e+03
I need to split them with some delimiter and export it to a .csv file with two columns so that I can plot the graph with Column 1 as X and Column two as Y.
Can anyone help me how to do it ?
Matlab R2015b
Respuesta aceptada
Más respuestas (2)
madhan ravi
el 24 de Jun. de 2019
Editada: madhan ravi
el 24 de Jun. de 2019
T = readtable('data.txt');
T1 = str2double(table2cell(T));
csvwrite('Wanted.csv',T1(~all(isnan(T1),2),:))
% after this the csv file can be read and it can be plotted
W = csvread('Wanted.csv');
plot(W(:,1),W(:,2))
3 comentarios
Jaffrey Hudson Immanuel Jeyakumar
el 24 de Jun. de 2019
Jaffrey Hudson Immanuel Jeyakumar
el 24 de Jun. de 2019
madhan ravi
el 24 de Jun. de 2019
No I didn't have any error messages
Mingde
el 23 de Mayo de 2022
0 votos
Hello,
I would like to segment data in matlab by cutting or removing the text from csv file. I want to get only the new data as csv file after remove text.
finally, I want to get the csv data without text.

Categorías
Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!