附上m文件的全文
function varargout = H_aem_av(varargin)
%H_AEM_AV M-file for H_aem_av.fig
% H_AEM_AV, by itself, creates a new H_AEM_AV or
raises the existing
% singleton*.
%
% H =
H_AEM_AV returns the handle to a new H_AEM_AV or the handle
to
% the
existing singleton*.
%
% H_AEM_AV('Property','Value',...) creates a new
H_AEM_AV using the
% given property value pairs. Unrecognized
properties are passed via
% varargin to H_aem_av_OpeningFcn.
This calling syntax produces a
% warning when there is an existing
singleton*.
%
% H_AEM_AV('CALLBACK') and
H_AEM_AV('CALLBACK',hObject,...) call the
% local function named CALLBACK in H_AEM_AV.M with
the given input
% arguments.
%
% *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
H_aem_av
% Last Modified by GUIDE v2.5 27-Nov-2014 21:22:17
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton,
...
'gui_OpeningFcn', @H_aem_av_OpeningFcn, ...
'gui_OutputFcn',
@H_aem_av_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(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 H_aem_av is made visible.
function H_aem_av_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 unrecognized
PropertyName/PropertyValue pairs from the
% command
line (see VARARGIN)
% Choose default command line output for H_aem_av
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
handles.H_aem=1e-6;
guidata(hObject,handles)
handles.av=1e6;
guidata(hObject,handles)
[handles.num,handles.txt] =
xlsread('C:\Users\Jian\Documents\MATLAB\H_aem-av_scr.xls','H_aem-av_scr');%读取excel表格sheet为H_aem-av_scr的内容
guidata(hObject,handles)
% UIWAIT makes H_aem_av wait for user response (see
UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command
line.
function varargout = H_aem_av_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 selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata,
handles)
% hObject handle to
popupmenu1 (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
popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected
item from popupmenu1
str = get(hObject, 'String');
val = get(hObject,'Value');
% Set current data to the selected data set.
switch str{val};
case '1e-6' % User selects peaks.
handles.H_aem =
1e-6;
case '3e-6' % User selects membrane.
handles.H_aem =
3e-6;
case '5e-6' % User selects sinc.
handles.H_aem =
5e-6;
case '7e-6' % User selects peaks.
handles.H_aem =
7e-6;
case '9e-6' % User selects membrane.
handles.H_aem =
9e-6;
end
guidata(hObject,handles)
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata,
handles)
% hObject handle to
popupmenu2 (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
popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected
item from popupmenu2
str = get(hObject, 'String');
val = get(hObject,'Value');
% Set current data to the selected data set.
display(val);
switch str{val};
case '1e6' % User selects peaks.
handles.av = 1e6;
case '1e7' % User selects membrane.
handles.av = 1e7;
case '1e8' % User selects sinc.
handles.av = 1e8;
case '1e9' % User selects peaks.
handles.av = 1e9;
case '1e10' % User selects membrane.
handles.av = 1e10;
end
guidata(hObject,handles)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata,
handles)
% hObject handle to
pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a
future version of MATLAB
% handles structure with
handles and user data (see GUIDATA)
[~,col_i]=find(strncmp(handles.txt, 'Electrolyte current
density norm (A/m^2), i electrolyte',50));
[~,col_vcell]=find(strncmp(handles.txt, '% V_cell',8));
[~,col_Haem]=find(strncmp(handles.txt, 'H_aem',5));
[~,col_av]=find(strncmp(handles.txt, 'av_scr',6));
data(:,1)=handles.num(:,col_av);%这一列是厚度m
data(:,2)=handles.num(:,col_Haem);%这一列是湿度
data(:,3)=handles.num(:,col_vcell);%这一列是输出电压(V)
data(:,4)=handles.num(:,col_i);%这一列是电流
data(:,4)=data(:,4)./10;%这一列是将电流从A/m^2换算为mA/cm^2
data(:,5)=data(:,3).*data(:,4);%功率(mW/cm^2)
%display(data);
[a,~]=find(data(:,2)(handles.H_aem*(1.-0.01)));
temp=data(a,:);
%assignin('base', 'temp', temp);
%display(temp);
[b,~]=find(temp(:,1)(handles.av*(1-0.01)));
temp1=temp(b,:);
%assignin('base', 'temp1', temp1);
%display (temp1);
[~,hLine1,hLine2] =
plotyy(handles.axes1,temp1(:,4),temp1(:,3),temp1(:,4),temp1(:,5));
display(handles.av);
display(handles.H_aem);
set(hLine1,'LineStyle','--')
set(hLine1,'Marker','o')
set(hLine2,'LineStyle',':')
set(hLine2,'Marker','*')
clear temp1;
clear temp;
% --- Executes during object creation, after setting all
properties.
function popupmenu2_CreateFcn(hObject, eventdata,
handles)
% hObject handle to
popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a
future version of MATLAB
% handles empty - handles
not created until after all CreateFcns called
% Hint: popupmenu 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
% --- Executes during object creation, after setting all
properties.
function popupmenu1_CreateFcn(hObject, eventdata,
handles)
% hObject handle to
popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a
future version of MATLAB
% handles empty - handles
not created until after all CreateFcns called
% Hint: popupmenu 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
% --- Executes during object creation, after setting all
properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1
(see GCBO)
% eventdata reserved - to be defined in a
future version of MATLAB
% handles empty - handles
not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1