How can I plot four columns of data from a text file?

2 views (last 30 days)
I have an output text file of data. The first column is the time and the following are x,y,&z values for displacement and continue for almost 20,000 lines. I am trying to plot time vs displacement in x,y,&z directions and can't seem to figure out how to use 'textscan'.

Accepted Answer

Mohammad Sami
Mohammad Sami on 2 Sep 2020
Edited: Mohammad Sami on 2 Sep 2020
Minimal code is as follows.
f = 'somefile.txt';
fid = fopen(f,'r');
out = textscan(fid,'%f %f %f %f');
out = horzcat(out{:});
fclose(fid);

More Answers (0)

Categories

Find more on Data Import and Export 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!