GUI changing axes and using handles struct
Afficher commentaires plus anciens
Alright, here goes....
my gui has multiple axes for plotting, I've setup 4 axes, axes1,....axes4
I have 40 analog signals with different Y axis limits, some signals are 0-1.0 others are 0-3600 plotting these on the same axes is not useful as the axes will be auto-scaled and the signal with the 0-1.0 limits will appear as a flat line losing its visual information.
I can play around with the y axis scaling, but decided to use multiple axes and the user will select a axes and plot what they need with the detail they need....
The analog signals are initially plotted with Visible OFF and the handles are saved for each plot. When the user selects a analog signal to display (from checkbox), I just turn the Visble to ON.....this works...great.
this set of code, sets the current axes to axes1, points to each column of data 1 to 40, while pointing at the column set the handle of the plot while visible OFF....works great...
axes(handles.axes1)
for k=1:1:40; hold on handles.plotbuf00(k,:) = plot(num0(:,k),'r','visible','off');
end hold off
guidata(hObject,handles);
Except the handle is always referenced to the axes of the initial plot command. That is, If I set the axes to axes 1, plot, visible OFF, .... then any attempt to reveal (Visible) this signal on axes 2(for example) is not possible.
when I need to reveal the selected waveform....I use the code.... function checkBoxCallback(hObject,eventData,checkBoxId)
value = get(hObject,'Value')
handles=guidata(gcbo);
if value==1
set( handles.plotbuf00(checkBoxId),'visible','on')
else
set( handles.plotbuf00(checkBoxId),'visible','off')
end
Is this due to the nature of the plot command? is the axes where the signal is plotted stored in its handle, if so, can it be manipulated.
If needed, I can work around this by initially plotting , visible OFF the signals on all 4 axes, and saving its handle on each axes
just throwing this out there to see if any slick option with Matlab is available.....
thanks gary
3 commentaires
Adam
le 20 Oct 2014
I'm not sure I fully understand what you are doing. Your code seems to just plot all 40 signals on axes 1 without the other axes being involved at all.
I wouldn't have though that line plotting would be that slow that you would need to pre-plot and then hide the data though. Is it not fast enough to just plot on demand on whatever axes is appropriate?
Jan
le 20 Oct 2014
Which part of the text is the question? Is the problem explained by this:
then any attempt to reveal (Visible) this signal on axes 2(for example) is not possible.
? If so, what does "not possible" mean? Do you get an error message or does the result differ from your expectations?
Is what due to the nature of the plot command?
I suggest to edit the original question and omit all sentences, which do not concern the problem. Neither "Alright, here goes" not the scaling of the axes matter. Your code would be readable, if you format it correctly.
Gary
le 20 Oct 2014
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Specifying Target for Graphics Output dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!