How to plot data in block?
Show older comments
Hello, I've data in .txt file as follows:
-42.135 -40.263 -38.384 -36.498 -34.608 -32.712 -30.811 -28.907 -26.999 -25.088
-23.174 -21.258 -19.339 -17.419 -15.497 -13.573 -11.648 -9.723 -7.796 -5.868
-3.940 -2.012 -0.084 1.845 3.773 5.701 7.629 9.555 11.481 13.406
15.330 17.252 19.173 21.092 23.008 24.922 26.833 28.742 30.646 32.547
34.443 36.335 38.220 40.100 41.972 43.837 45.692 47.537 49.371 51.191
52.995 54.781
5.543 5.325 5.061 4.786 4.535 4.328 4.146 3.988 3.864 3.779
3.728 3.705 3.715 3.763 3.862 4.044 4.375 4.985 6.032 7.594
9.759 12.214 13.494 14.008 13.810 13.130 12.751 12.998 13.764 14.557
14.307 13.415 13.135 13.130 12.965 12.590 11.975 11.391 10.867 10.446
10.088 9.760 9.401 9.021 8.594 8.124 7.615 7.106 6.737 6.495
6.292 6.119
I want to plot above upper block(52 data points) data in x-axis and that in lower block in y-axis using matlab command. Any suggestions?
Accepted Answer
More Answers (1)
Kirby Fears
on 1 Oct 2015
Get the data into your Matlab workspace using the import data tool or one of the following functions: importdata,dlmread,textscan.
You should be able to split the data into two matrices X and Y easily. Afterward you can vectorize X and Y then plot.
X = X(:); % vectorizing X
Y = Y(:); % vectorizing Y
plot(X,Y);
Hope this helps.
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!