How to calculate average of each column on a test file
3 次查看(过去 30 天)
显示 更早的评论
How do i calculate the average of each column from a text file, and after having the two average of X,Y coordinates how do I plot the point
0 个评论
回答(1 个)
Steven Lord
2021-7-8
2 个评论
Steven Lord
2021-7-8
There are several different ways. Since in the case you describe your single point is unlikely to be exactly one of the points in your data set a simple way is to use hold on.
xy = rand(10, 2);
m = mean(xy, 1);
scatter(xy(:, 1), xy(:, 2), 'ro'); % You could also use plot here
hold on % So the subsequent plot call doesn't reset the axes
plot(m(1), m(2), 'kx')
Alternately you could use one call to plot to create two lines.
figure
plot(xy(:, 1), xy(:, 2), 'ro', m(1), m(2), 'kx')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!