I want to plot X & Y data for different Time step.

2 ビュー (過去 30 日間)
Tan Has
Tan Has 2012 年 4 月 1 日
Any one could help me> I am very new at matlab.
I'm trying to figure out a way to show in a scatter plot. I have excel and text file data file where at 900 sec I have 44 xy points, at 950 sec 234 points,....., at 1150 sec 260 points. How can I do that.
Example data:
# THIS IS A EXTINCTION PLOT FILE
# The Time Passed = 900
# The Volume Entered = 0.000156572
XPOS YPOS AF
0.22 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.21 0.105 0.00000D+00
0.205 0.105 0.00000D+00
0.205 0.105 0.00000D+00
0.14 0.095 0.00000D+00
0.135 0.095 0.00000D+00
....
....
0.23 0.095 0.00000D+00
0.23 0.1 0.00000D+00
0.225 0.105 0.00000D+00
0.22 0.105 0.00000D+00
# THIS IS A EXTINCTION PLOT FILE
# The Time Passed = 950
# The Volume Entered = 0.000156707
XPOS YPOS AF BF CF
0.22 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.21 0.105 0.00000D+00
0.205 0.105 0.00000D+00
....
0.23 0.075 0.00000D+00
0.23 0.08 0.00000D+00
0.23 0.08 0.00000D+00
0.23 0.085 0.00000D+00
0.23 0.09 0.00000D+00
0.23 0.09 0.00000D+00
0.23 0.095 0.00000D+00
0.23 0.1 0.00000D+00
0.225 0.105 0.00000D+00
0.22 0.105 0.00000D+00

採用された回答

Geoff
Geoff 2012 年 4 月 1 日
How about this:
hold off;
scatter( x1, y1, 'bo' ); % Blue circles
hold on;
scatter( x2, y2, 'gv' ); % Green triangles
scatter( x3, y3, 'rs' ); % Red squares
hold off;
legend( '900 seconds', '950 seconds', '1150 seconds' );
The hold on command will cause new plots to be added to the existing figure.

その他の回答 (3 件)

Tan Has
Tan Has 2012 年 4 月 2 日
Thanks.
All this coordinates falls within the 54x78 grid (number of grid 4212). I want to plot all these data within this area.
How matlab reads xy data in different time steps?
Should I need to use i (ex: i=18, where 18x50=900sec. 1 time step 50 sec)to define which data it going to plot.
how matlab read 44 xy points(900 sec) from the file and then it reads 234 points in the next time step (950)?

Tan Has
Tan Has 2012 年 4 月 2 日
I am trying this. but My plot needs to show within 54x78 grid. How can I plot the next time step by only change the i value into 2 (for 950 sec)? where xy has 234 points.
************************
i=1;
% fh=figure;
m=4+(i-1)*48;
n=47+(i-1)*48;
M=dlmread('Extinction_Node.plt',',',m,0, [m 0 n 3]);
xarray=M(:,1);
yarray=M(:,2);
EXT=M(:,3);
hold off;
scatter( xarray, yarray, 'bo' );
  2 件のコメント
Geoff
Geoff 2012 年 4 月 2 日
Does your data have a column of time values in it? The usual thing to do (let's say that column 4 has the time) is:
t = M(:,4);
x900 = xarray(t==900);
x950 = xarray(t==950);
... etc
Otherwise, if you really want to read different data lengths and you know the lengths already, don't use those formulae for 'm' and 'n'. Just do one read for each set. That is, hard-code the row and column into multiple calls to 'dlmread'.
Geoff
Geoff 2012 年 4 月 2 日
Sorry, I forgot you had given a sample data file. The easiest way for you to proceed will be to hard-code the numbers as in my second suggestion above.

サインインしてコメントする。


Tan Has
Tan Has 2012 年 4 月 2 日
How can I make the figure background transparent? So that I can Plot that into my another graph.
  1 件のコメント
Geoff
Geoff 2012 年 4 月 2 日
That's what 'hold on' does. It plots onto the same axes as the last plot. You have a lot of questions, and it is not helpful to post them here. Post a new question when you need to know something, so that other people can search for relevant answers if they want to do the same thing.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by