Issue Linking Plot Data in R2015a

4 次查看(过去 30 天)
Hi, I'm having trouble linking plot data in MATLAB R2015a. It's better to show than describe:
f1 = figure;
plot(dataSet1(2,:),dataSet1(1,:),'o');
linkdata on;
When I execute 'linkdata on', I get the 'graphics have no data sources, cannot link plot'. I have also tried having 'linkdata on' first. That doesn't work either. What does work, curiously enough is explicitly defining the XDataSource and YDataSource for each line in the plot. Ex:
hpl = plot(dataSet1(2,:),dataSet1(1,:),'o');
set(hpl,'XDataSource','dataSet1(2,:)');
set(hpl,'YDataSource','dataSet1(1,:)');
linkdata on;
I'd rather avoid that if I can, since that would lead to far more lines of code than should be necessary. My questions therefore are,
  1. Is there a way to get the first way to work (i.e. not explicitly calling out the sources after plotting)?
  2. If not, why does the first way not work, but the second one work?
Thanks!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by