how to keep helpdlg displayed while user manipulates plot
6 次查看(过去 30 天)
显示 更早的评论
Here is what I am trying to do: plot a line, suggest to user (helpdlg) they zoom the plot so they can find some info about a spike in the data, put another inputdlg for them to enter the data info needed to define a ROI (region of interest) where we want to replace the spike data with a spline estimate.
Result of zooming below, but I need to move my "helpdlg" back to where I can see it (after zooming plot) in order to press the "OK" button:
Problem is that if I make the helpdlg modal, the user cannot zoom the plot but if I do not make it modal it gets obscured by the plot while they zoom it. So, how can I keep the "helpdlg" visible so they can push its button after zooming the plot? Or is there a better way to do this?
Once the data is entered, I calculate a spline fit to the data in the ROI and show them the result -- they can accept the fit or redefine the ROI. I do this with a "questdlg" but this also has problems -- it obscures the result (see plots below). Now I can manually move the "questdlg" window each time to see what is under it (as shown in the second plot), but that seems clumsy.
Here is my code:
fp = plot(fx,fy,'-o'); %plot the line
%user reminder to zoom plot to find the spike center and edges
hb = helpdlg('Zoom to find spike center, just hit "enter" if zooming not needed', 'Zoom plot');
waitfor(hb); %wait for user to close the help dialog
%put up the input dialog asking for 3 data parameters
loc = inputdlg({'Center Channel : ';'Points to Left : ';'Points to Right : '},'Define the fit region',1,defAns);
xc = str2double(loc{1}); %center channel number
xl = str2double(loc{2}); %points to left
xr = str2double(loc{3}); %points to right
p1 = xc-xl-1; %calc last point to left of fix ROI
p2 = xc+xr+1; %calc first point to right of fix ROI
tr = [(xc-20):p1 p2:(xc+20)]; %region of good points near spike for spline
ts = xc-xl:xc+xr; %region to replace by spline interpolation
est = interp1(tr,fy(tr),ts,'spline'); % spline estimate
tss = [p1:p2]; % x-data just for plotting the fit line
yss = [new(p1) est new(p2)]; % y-data just for plotting the fit line
%plot original and fixed data in the expanded ROI
plot(fx(xc-20:xc+20),fy(xc-20:xc+20),'bo-',tss,yss,'r-',ts,est,'rs');
%put up dialog to ask user if they like the fix result
rply = questdlg('Accept the fix?','Options','Yes','Retry','No','No');
The result after the "questdlg" showing the dialog window obscuring the interesting region of the plot
Result after manually moving the "questdlg" window. What is the best way to specify a location for the "questdlg" so it does not obscure the interesting region of the plot below?
Thanks for your time. I am just a beginner in interactive, or UI, graphics in Matlab. Trying to learn.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!