How to read and plot a txt file
65 views (last 30 days)
Show older comments
I have this text file with time stamps and with values that I am trying to plot. I am not well versed in MatLab to even begin writing a code.
0 Comments
Accepted Answer
Voss
on 10 Nov 2023
filename = 'Data1.txt';
T = readtable(filename)
plot(T.(1),T.(2))
3 Comments
Voss
on 10 Nov 2023
Edited: Voss
on 10 Nov 2023
You're welcome!
You can avoid deleting the arrows from the text file, if that's more convenient. The file is read just fine by readtable, so all you have to do is plot with the 3rd column instead of the 2nd:
filename = 'Data2.txt';
T = readtable(filename)
plot(T.(1),T.(3)) % plot third column vs first column
More Answers (0)
See Also
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
