Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
regenerate Array name form Plot (Important Question)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hey Guys, This is a very important question, which will decide the way I script my program.However it is quite simple.
If i plot (for exmaple x = 1:10 / Rainbow = 1:2:20), is it possible to get back the name of the plotted Arrays ( x and Rainbow ) ?
The reason behind my Question is: I am creating a GUI which allows the use to change Points in the Plot. Now i need a way to 100% identify the Array which was plotted.( There several Plotlines in one axes)
0 Commenti
Risposte (3)
Star Strider
il 20 Ago 2014
Not to my knowledge. They’re known to the axes object as 'XData' and 'YData'. If you label the axes with the array names you can of course get them as 'XLabel' and 'YLabel'. There is also a 'UserData' matrix (that I’ve never used) that you can store in and retrieve information from. The 'UserData' property may be your best option.
0 Commenti
Joseph Cheng
il 20 Ago 2014
I would say when you're defining each plot you also set the X and Y data source parameters located in the axes properties. See my example:
x = 1:10;rainbow = 1:2:20;
fig = figure;
hold on
for ind =1:4
ax(ind) = plot(ind*x,ind*rainbow);
set(ax(ind),'XDataSource',['x*' num2str(ind)])
set(ax(ind),'YDataSource',['raibow*' num2str(ind)])
end
for ind =1:4
disp(['plot ' num2str(ind) ': was ' get(ax(ind),'XDataSource') ' and ' get(ax(ind),'YDataSource')])
end
1 Commento
Joseph Cheng
il 20 Ago 2014
Which now thinking about it more could be easy to implement as depending on how you are defining the multiple plots on the axis. If there is a X list box and another for Y plus an Add to plot button then in the add to plot button would get the name from the xname=get(handles.listboxX,'String) then from that get the index.
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!