I want to plot X & Y data for different Time step.
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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.
0 个评论
更多回答(3 个)
Tan Has
2012-4-2
2 个评论
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
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
2012-4-2
1 个评论
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 Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!