MATLAB: Hi, does anybody knows how to plot graph using matlab from a txt file

plot graph

I wanted to plot a graph using matlab from a txt file? Do i need to create any function in order to plot this graph? Im trying to plot a time history graph (y axis in voltage, x axis in time)

Best Answer

Your file has 220250 elements, so it takes a while to read it and plot it.
Try this:
D = readtable('0.5hz.txt', 'HeaderLines',4);
Ts = str2double(D.dt_(1));
DataC = D.dt_(3:end);
DataM = str2double(DataC);
Time = linspace(0, numel(DataM), numel(DataM))*Ts;
figure(1)
plot(Time, DataM)
grid