MATLAB Answers

figure data point access in 2018a

1 view (last 30 days)
Lian on 30 Apr 2018
Commented: Lian on 30 Apr 2018
Sometimes I need to manually remove data points from an existing figure which are zero. It could be done fairly easily in previous releases. However I found that I can no longer do so in 2018a mac version. In particular, in figure property, the YData only shows 1xN array, and I cannot access the numerical values of those plotted points. Is this function removed from this release?
Lian on 30 Apr 2018
I tested a very simple plot: figure, plot(sin(0:0.1:2),'ko-'); I understand that I can do that using command lines, but it is a very wired problem, as it is supposed to be very straightforward. Maybe it is due to the installation of some special toolboxes?

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 30 Apr 2018
Edited: Ameer Hamza on 30 Apr 2018
You can set the properties programmatically using line handles. For example
p = plot(1:10); % p is plot handle and have property XData and YData.
p.XData = 1:10;
p.YData = (1:10).^2;
It will update the line according to new data.

Community Treasure Hunt

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

Start Hunting!