【发布时间】:2015-02-04 02:58:56
【问题描述】:
我试图从用户那里得到 2 分并显示这些点之间的频谱图,我使用以下代码成功地做到了,但我不知道为什么让我低于错误?
我也想知道,如果我想在我的代码中放置一个重置按钮以将绘图恢复到初始状态,我该怎么做?
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 ]);
使用集合出错 发现错误的属性值。 对象名称:轴 物业名称:'YLim' 值必须是递增且非 NaN。
轴错误>LocSetLimits(第 208 行) 设置(斧头,...
轴错误(第 94 行) LocSetLimits(ax(j),cur_arg);
M_player 中的错误>Zoom_Callback(第 202 行) 轴([handles.from,handles.to,minY,maxY]);
gui_mainfcn 中的错误(第 96 行) feval(varargin{:});
M_player 中的错误(第 42 行) gui_mainfcn(gui_State, varargin{:});
错误 @(hObject,eventdata)M_player('Zoomb_Callback',hObject,eventdata,guidata(hObject))
评估 uicontrol 回调时出错
【问题讨论】:
-
那么在您调用axis([...] 时,y 轴的限制是minY 到maxY,它们是相同。因此您会收到错误消息。也许您在获取 minY 或 maxY 时出错了?
-
谢谢。我只想要 x 轴缩放变化和 y 提醒它的缩放,但不知道我该怎么做!我试图从频谱图中获取 y 比例但没有成功:(