MATLAB Answers


How to plot selective data?

Asked by Kelsey
on 19 Sep 2013

I have some data in the following form, outputted from a different computer program:

(That is, 3 separate columns of data...continuing on for 1000 rows) I am wondering how to create a plot with JUST the first and second columns, or first and third columns, of data--seeing as doing this manually would take forever. How do I arrange these data such that they're in matrices that are readable for MATLAB? Thanks much in advance!



No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek
on 19 Sep 2013
Edited by Azzi Abdelmalek
on 19 Sep 2013

If A is your matrix




If your data are in a text file you can read it:



on 19 Sep 2013

Great! But how do I put all this data in matrix form? (i.e., brackets and commas/semicolons)

Azzi Abdelmalek
on 19 Sep 2013

just add square brackets

A=[1 2 3
 4 5 6
 7 8 9]

Answer by Jan Simon
on 19 Sep 2013

What exactly is the problem? Are these data written to a file and you are looking for the fscanf command to read them? Does dlmread as suggested by Azzi work or not?


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today