How to plot selective data?

1 次查看(过去 30 天)
Kelsey
Kelsey 2013-9-19
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!

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-9-19
编辑:Azzi Abdelmalek 2013-9-19
If A is your matrix
plot(A(:,1),A(:,2))
%or
plot(A(:,1),A(:,3))
If your data are in a text file you can read it:
A=dlmread('yourfilename.txt')
  2 个评论
Kelsey
Kelsey 2013-9-19
Great! But how do I put all this data in matrix form? (i.e., brackets and commas/semicolons)
Azzi Abdelmalek
Azzi Abdelmalek 2013-9-19
just add square brackets
A=[1 2 3
4 5 6
7 8 9]

请先登录,再进行评论。


Jan
Jan 2013-9-19
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?

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by