matlab - How cam I zoom in spectrogram horizontally in my codes? -
i'm trying give 2 points user , showing spectrogram between points, following codes successfully, don't know why below errors?
also want know, if want put reset button in code revert plot initial state how can that?
function from_callback(hobject, eventdata, handles) handles.from=str2double(get(hobject, 'string')); guidata(hobject,handles); function from_createfcn(hobject, eventdata, handles) if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); end function to_callback(hobject, eventdata, handles) handles.to=str2double(get(hobject, 'string')); guidata(hobject,handles); function to_createfcn(hobject, eventdata, handles) if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); end function zoomb_callback(hobject, eventdata, handles) miny=min(str2double(get(handles.samplef, 'string')))*1000; maxy=max(str2double(get(handles.samplef, 'string')))*1000; axes(handles.axes2); axis([handles.from, handles.to, miny, maxy ]);
error using set bad property value found. object name : axes property name : 'ylim' values must increasing , non-nan.
error in axis>locsetlimits (line 208) set(ax,...
error in axis (line 94) locsetlimits(ax(j),cur_arg);
error in m_player>zoomb_callback (line 202) axis([handles.from, handles.to, miny, maxy ]);
error in gui_mainfcn (line 96) feval(varargin{:});
error in m_player (line 42) gui_mainfcn(gui_state, varargin{:});
error in @(hobject,eventdata)m_player('zoomb_callback',hobject,eventdata,guidata(hobject))
error while evaluating uicontrol callback
ok according comment, here how can change scale of x axis , keep same range y axis.
in order actual limits of y axis axes2, can use following:
ylimit = get(handles.axes2,'ylim')
the values in same format of axes, i.e. pixel, normalized, etc.
this give 2-element vector containing min , max values. therefore, in call axis
make in code, use keep range of y-axis constant:
ylimit = get(handles.axes2,'ylim') axis([handles.from, handles.to, ylimit(1), ylimit(2)]);
hope meant!
Comments
Post a Comment