Здрастуйте!!! Срочно нужно доделать приложение Guide с несколькими элементами: кнопки, список, график, флажки(отметка сетки на графике) и панель ввода текста!! из него работает только лишь флажки с графиком и обе кнопки. Не срабатывают на команды панель с 2-мя строками и панель ввода текста (edit). Прошу помочь доделать код программы....Никакая литература и форумы не помогают
Заранее благодарен!!
Код:
% --- Executes just before Graphic is made visible.
function Graphic_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Graphic (see VARARGIN)
% Choose default command line output for Graphic
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Graphic wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Graphic_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in Buildbtn.
function Buildbtn_Callback(hObject, eventdata, handles)
% hObject handle to Buildbtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.Graphic);
cla;
k1=0.11; k2=9; k3=8; k4=11.4; k5=1.1; k6=1.4; k7=1;
n1=k2; m1=[1 k3]; n2=k4; m2=[k5 k6 0];
g1=k1; g2=tf(n1,m1); p=tf(n2,m2); g3=k7;
W=series(g1,g2); W1=series(W,p);
W_zs=feedback(W1,g3,[-1]);
set (handles.maxtime, 'String')
t=get(handles.maxtime, 'String');
t=str2double(t);
if get(handles.GridonX, 'Value')
% Флаг включен, следует добавить линии сетки
set(gca, 'XGrid', 'on')
else
% Флаг выключен, следует убрать линии сетки
set(gca, 'XGrid', 'off')
end
if get(handles.GridonY, 'Value')
% Флаг включен, следует добавить линии сетки
set(gca, 'YGrid', 'on')
else
% Флаг выключен, следует убрать линии сетки
set(gca, 'YGrid', 'off')
end
xlabel('t(time)');
ylabel('A(amplitude)');
grid on;
% Кнопка Построить должна стать недоступной после вывода графика
set(hObject, 'Enable', 'off')
% Кнопка Очистить должна стать доступной
set(handles.Clearbtn, 'Enable', 'on')
set(handles.maxtime,'Enable','on');
step(W_zs,t);
impulse(W_zs,t)
% --- Executes on button press in Clearbtn.
function Clearbtn_Callback(hObject, eventdata, handles)
% hObject handle to Clearbtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cla % очистка осей
% Кнопка Очистить должна стать недоступной после очистки осей
set(hObject, 'Enable', 'off')
% Кнопка Построить должна стать доступной
set(handles.Buildbtn,'Enable','on');
% --- Executes on button press in GridonX.
function GridonX_Callback(hObject, eventdata, handles)
% hObject handle to GridonX (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of GridonX
if get(handles.GridonX, 'Value')
% Флаг включен, следует добавить линии сетки
set(gca, 'XGrid', 'on')
else
% Флаг выключен, следует убрать линии сетки
set(gca, 'XGrid', 'off')
end
% --- Executes on button press in GridonY.
function GridonY_Callback(hObject, eventdata, handles)
% hObject handle to GridonY (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of GridonY
if get(handles.GridonY, 'Value')
% Флаг включен, следует добавить линии сетки
set(gca, 'YGrid', 'on')
else
% Флаг выключек, следует убрать линии сетки
set(gca, 'YGrid', 'off')
end
% --- Executes on selection change in Spysok.
function Spysok_Callback(hObject, eventdata, handles)
% hObject handle to Spysok (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns Spysok contents as cell array
% contents{get(hObject,'Value')} returns selected item from Spysok
Spysok = get(handles.Spysok);
% --- Executes during object creation, after setting all properties.
function Spysok_CreateFcn(hObject, eventdata, handles)
% hObject handle to Spysok (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function maxtime_Callback(hObject, eventdata, handles)
% hObject handle to maxtime (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of maxtime as text
% str2double(get(hObject,'String')) returns contents of maxtime as a double
nmax=get(hObject.maxtime, 'String', t);
if get(hObject.maxtime, 'String', t);
set(handles.Graphic, 'XGrid')
end
get (hObject.Buildbtn, 't');
tmax(nmax)=str2double(nmax);
% --- Executes during object creation, after setting all properties.
function maxtime_CreateFcn(hObject, eventdata, handles)
% hObject handle to maxtime (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end