⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vc.m

📁 Matlab是常用的演草纸式编程工具
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = VC(varargin)
% VC M-file for VC.fig
%      VC, by itself, creates a new VC or raises the existing
%      singleton*.
%
%      H = VC returns the handle to a new VC or the handle to
%      the existing singleton*.
%
%      VC('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in VC.M with the given input arguments.
%
%      VC('Property','Value',...) creates a new VC or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before VC_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to VC_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help VC

% Last Modified by GUIDE v2.5 01-Dec-2005 09:30:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @VC_OpeningFcn, ...
                   'gui_OutputFcn',  @VC_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before VC is made visible.
function VC_OpeningFcn(hObject, eventdata, handles, varargin)
shake=s_out_ini;%获得握手信号

if shake==170
    set(handles.text14,'String','系统准备好,请输入电压值!');
else
    set(handles.text14,'BackgroundColor',[1,0,0],'String','串口通信故障,请检查!')
end
handles.Voltage=[1,1,1,1,1,1,1,1
         2,2,2,2,2,2,2,2
         3,3,3,3,3,3,3,3
         4,4,4,4,4,4,4,4
         5,5,5,5,5,5,5,5
         6,6,6,6,6,6,6,6
         7,7,7,7,7,7,7,7
         8,8,8,8,8,8,8,8];
handles.N_Voltage=[1,1,1,1,1,1,1,1
         2,2,2,2,2,2,2,2
         3,3,3,3,3,3,3,3
         4,4,4,4,4,4,4,4
         5,5,5,5,5,5,5,5
         6,6,6,6,6,6,6,6
         7,7,7,7,7,7,7,7
         8,8,8,8,8,8,8,8];

% 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 VC (see VARARGIN)

% Choose default command line output for VC
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes VC wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = VC_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 during object creation, after setting all properties.function os11_CreateFcn(hObject, eventdata, handles)% hObject    handle to os11 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os11_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os11,'String'));
s_out(1,val/0.73)
set(handles.oss1,'value',val);% hObject    handle to os11 (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 os11 as text%        str2double(get(hObject,'String')) returns contents of os11 as a double% --- Executes during object creation, after setting all properties.function os12_CreateFcn(hObject, eventdata, handles)% hObject    handle to os12 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os12_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os12,'String'));
s_out(2,val/0.73)
set(handles.oss2,'value',val);% hObject    handle to os12 (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 os12 as text%        str2double(get(hObject,'String')) returns contents of os12 as a double% --- Executes during object creation, after setting all properties.function os13_CreateFcn(hObject, eventdata, handles)% hObject    handle to os13 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os13_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os13,'String'));
s_out(3,val/0.73)
set(handles.oss3,'value',val);% hObject    handle to os13 (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 os13 as text%        str2double(get(hObject,'String')) returns contents of os13 as a double% --- Executes during object creation, after setting all properties.function os14_CreateFcn(hObject, eventdata, handles)
% hObject    handle to os14 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os14_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os14,'String'));
s_out(4,val/0.73)
set(handles.oss4,'value',val);% hObject    handle to os14 (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 os14 as text%        str2double(get(hObject,'String')) returns contents of os14 as a double% --- Executes during object creation, after setting all properties.function os21_CreateFcn(hObject, eventdata, handles)% hObject    handle to os21 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os21_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os21,'String'));
s_out(5,val/0.73)
set(handles.oss5,'value',val);% hObject    handle to os21 (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 os21 as text%        str2double(get(hObject,'String')) returns contents of os21 as a double% --- Executes during object creation, after setting all properties.function os22_CreateFcn(hObject, eventdata, handles)% hObject    handle to os22 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os22_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os22,'String'));
s_out(6,val/0.73)
set(handles.oss6,'value',val);% hObject    handle to os22 (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 os22 as text%        str2double(get(hObject,'String')) returns contents of os22 as a double% --- Executes during object creation, after setting all properties.function os23_CreateFcn(hObject, eventdata, handles)% hObject    handle to os23 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os23_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os23,'String'));
s_out(7,val/0.73)
set(handles.oss7,'value',val);% hObject    handle to os23 (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 os23 as text%        str2double(get(hObject,'String')) returns contents of os23 as a double% --- Executes during object creation, after setting all properties.function os24_CreateFcn(hObject, eventdata, handles)% hObject    handle to os24 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction os24_Callback(hObject, eventdata, handles)
val = str2double(get(handles.os24,'String'));
s_out(8,val/0.73)
set(handles.oss8,'value',val);% hObject    handle to os24 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -