Plotting data from text file
Mostrar comentarios más antiguos
Dear All,
The problem that I am dealing with is to obtain a plot from a text file has 5615917 lines of data. The shorthaned content of the data file that I am dealing with looks like as follows.
channel names:
09/07/2016 06:20:09 PM - Thermocouple - SC1Mod2_ai2
start times:
9/7/2016 18:20:13.504689
dt:
0.010000
data:
8.857533E+1
8.857165E+1
8.856430E+1
8.857165E+1
8.856798E+1
8.857165E+1
8.856798E+1
8.857900E+1
8.856430E+1
8.857165E+1
8.857165E+1
8.856798E+1
8.856430E+1
8.856798E+1
.
.
.
2.635587E+1
2.635209E+1
2.635965E+1
2.635587E+1
2.635209E+1
2.635965E+1
2.635965E+1
2.635209E+1
2.635587E+1
2.635965E+1
2.634832E+1
and the code that I use is
clear all
close all
clc
fileID = fopen('ThermocoupleCombined.txt','r');
Crude_Data = textscan(fileID,'%f','HeaderLines','2');
fclose(fileID);
C = transpose(0:0.01:0.01*(length(Crude_Data{1})-1));
plot(C,Crude_Data{1})
The code above draws the data up to 76757 and the rest is not included inside "Crude_Data" and not plotted.
Can you please give me your suggestions regarding the problem I have?
8 comentarios
Adam
el 13 de Oct. de 2016
Does the format change at line 76757?
KSSV
el 13 de Oct. de 2016
Are you sure that after the word 'data' all are numbers and no text exits? Go to the line 76757 and see what is the data there.
Cagas Akalin
el 13 de Oct. de 2016
What is length of Crude_Data?
Try with importdata....
data = imortdata('yourfile') ;
then data will be a structure with your matrix of numbers and text. Take matrix from the data (data.data) and see it's size.
Cagas Akalin
el 13 de Oct. de 2016
Editada: Cagas Akalin
el 13 de Oct. de 2016
KSSV
el 13 de Oct. de 2016
That case there is a problem in plot. check class(B) and class(C)..tell me there classes. If possible try to attach the txt file here.
Cagas Akalin
el 13 de Oct. de 2016
KSSV
el 13 de Oct. de 2016
That's why error popped out. What are respective sizes? Mean while I will check your data.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Text Files 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!
