Hello,
I recently converted an app originally designed in GUIDE into App Designer. I did not write the original code, and due to the conversion I'm at a bit of a lose on how to even search for an answer to this quiestion. I apologize if this has been covered elsewhere.
In my app, I can load txt files which contain signal data on a time scale. Using the app, I can scroll to a signal of interest. I then set the 'origo', or the origin of the signal with a Callback function, which replots the signal over a consistent timescale.
function setorigo_Callback(app, event)
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event);
global origo t data
axes(handles.clickplot)
[origo,y]=ginput(1);
cla;
plot(t,log10(data.nix),'.');
set(handles.clickplot,'xlim',[origo origo+0.425],'xtick',[origo+0.0485:0.012:origo+0.425]','xgrid','on');
hold on
plot(origo,y,'or');
end
This works exactly like the old tool did, which is great. I can process the signal, and move on. The issue is when I zoom out, and then scroll to find my next signal of interest. If I at all double click anywhere on the plot, the plot zooms once again to the consistent timescale created by the setorigo_Callback function. Additionally, if I find other signals of interested and process them, including a setting a new origo location on the x-axis, if I double click at all it will zoom to the first origo time scale I specified. It doesn't matter if I've set a new origo, the double click will send me to the location of the first origo process when I first opened the app.
Here are my Zoom in and out functions:
function uitoggletool2_ClickedCallback(app, event)
app.resetInteractions(event);
state = app.uitoggletool2.State;
zoomModeObject = zoom(app.figure1);
if state
zoomModeObject.Direction = 'out';
zoomModeObject.Enable = 'on';
else
zoomModeObject.Enable = 'off';
end
end
function uitoggletool1_ClickedCallback(app, event)
app.resetInteractions(event);
state = app.uitoggletool1.State;
zoomModeObject = zoom(app.figure1);
if state
zoomModeObject.Direction = 'in';
zoomModeObject.Enable = 'on';
else
zoomModeObject.Enable = 'off';
end
end
Anyone have any idea what's going on here? Or futhermore, how I can stop it? I can't seem to clear the origo valuable, or wipe the plot's memory of the first origo set. Please let me know if you'd like to see other sections of the code.
Many thanks!