Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
regenerate Array name form Plot (Important Question)
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (3개)
Star Strider
2014년 8월 20일
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
Joseph Cheng
2014년 8월 20일
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
Joseph Cheng
2014년 8월 20일
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.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!