MATLAB Answers

Cathrine
0

Plot of dspesific rows and columns

Asked by Cathrine
on 17 Jul 2019
Latest activity Answered by Star Strider
on 17 Jul 2019
I have a txt file that I would like open, and plot the values from row 39 column 2 (x-axis) vs row 39 column 4 (y-axis) for about 8000 rows. It is also desirable to only plot every 10th row to make the script go faster.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Star Strider
on 17 Jul 2019

Importing your file depends on what is in it (numeric only, numeric with text headers, or something else). If you have R2019a or later, use the readmatrix function to import your file. Otherwise, dlmread and its friends are options. If you need help with that, attach (upload) your file (or a representative sample of it) here.
Once you have imported your file, the rest is straightforward:
A = readmatrix('YourFile.txt');
x = A(39:10:end, 2);
y = A(39:10:end, 4);
plot(x, y)
grid

  0 Comments

Sign in to comment.