How to replace a column in a text file with time and plot a graph from it?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Savouri
el 4 de Mzo. de 2020
Comentada: KALYAN ACHARJYA
el 4 de Mzo. de 2020
The first column shows the frequency of data aquisition, which is 1000 hz. But I need to replace the first column of the text file with time, starting with 0 secs, then 0.0001s till 60s. it is then used to plot a graph of data points, where the 2nd and 3rd columns are outputs. The picture of text file is attached.
Any help is appreciated.
I tried with the following command but it didnt work and took forever.
data = load('test1.txt');
data(:, 1) = 0:0.0001:60000;
0 comentarios
Respuesta aceptada
KALYAN ACHARJYA
el 4 de Mzo. de 2020
Editada: KALYAN ACHARJYA
el 4 de Mzo. de 2020
Please note: It should be column vector
data = load('test1.txt');
data(:, 1) =[0:0.0001:60000]';
5 comentarios
KALYAN ACHARJYA
el 4 de Mzo. de 2020
Its simple
>> length(data(:,1))
ans =
62000
>> length(0:0.0001:60000)
ans =
600000001
Make the array 0:0.0001:60000 having the same length as length(data(:,1)), which is 62000, or use
linspace(0,60000,62000); % set the step size as requred
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Data Preparation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!