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

📄 als2004m.m

📁 多元曲线解析-交替最小二乘法,MCR-ALS
💻 M
📖 第 1 页 / 共 5 页
字号:
evalin('base','als_opt.noneg.cneg=cneg;');
evalin('base','clear cneg ncneg');

% --- Executes during object creation, after setting all properties.
function popup_nsnn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popup_nsnn (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

dim=evalin('base','min(size(als_opt.iniesta))');
j=2;
llistanns(1)={'select...'};
for i=0:1:dim,
    llistnns=[i];
    llistanns(j)={llistnns};
    j=j+1;
end;
set(hObject,'string',llistanns)



% --- Executes on selection change in popup_nsnn.
function popup_nsnn_Callback(hObject, eventdata, handles)
% hObject    handle to popup_nsnn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popup_nsnn contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popup_nsnn

nspneg=get(hObject,'Value')-2; 

assignin('base','nspneg',nspneg);
evalin('base','als_opt.noneg.nspneg=nspneg;');



dim=evalin('base','min(size(als_opt.iniesta))');
nexp=evalin('base','als_opt.nexp');
ialgs=evalin('base','als_opt.noneg.ialgs');

if ialgs == 0
    if nspneg == dim
        spneg = ones(dim,nexp);
        set(handles.text_spsnn,'enable','off');
        set(handles.edit_spsnn,'enable','off','string','');
    elseif  nspneg == 0
        spneg = zeros(dim,nexp);
        set(handles.text_spsnn,'enable','off');
        set(handles.edit_spsnn,'enable','off','string','');   
    elseif  nspneg == -1
        spneg=[];
        set(handles.text_spsnn,'enable','off');
        set(handles.edit_spsnn,'enable','off','string','');
    else
        spneg=[];
        set(handles.text_spsnn,'enable','on');
        set(handles.edit_spsnn,'enable','on'); 
    end
else
    spneg = ones(dim,nexp);
end

assignin('base','spneg',spneg);
evalin('base','als_opt.noneg.spneg=spneg;');
evalin('base','clear spneg nspneg');

% --- Executes during object creation, after setting all properties.
function edit_spcnn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_spcnn (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'));
end

function edit_spcnn_Callback(hObject, eventdata, handles)
% hObject    handle to edit_spcnn (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 edit_spcnn as text
%        str2double(get(hObject,'String')) returns contents of edit_spcnn as a double

cnegr=str2num(get(hObject,'String'));
cneg = ones(evalin('base','als_opt.nexp'),1)*cnegr;
assignin('base','cneg',cneg);
evalin('base','als_opt.noneg.cneg=cneg;');
evalin('base','clear cneg');

% --- Executes during object creation, after setting all properties.
function edit_spsnn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_spsnn (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'));
end

function edit_spsnn_Callback(hObject, eventdata, handles)
% hObject    handle to edit_spsnn (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 edit_spsnn as text
%        str2double(get(hObject,'String')) returns contents of edit_spsnn as a double


spnegr= str2num(get(hObject,'String'));
spneg = spnegr'*ones(1,evalin('base','als_opt.nexp'));

assignin('base','spneg',spneg);
evalin('base','als_opt.noneg.spneg=spneg;');
evalin('base','clear spneg');


% *************************************************************************
% unimodal
% *************************************************************************


% --- Executes on button press in check_uni.
function check_uni_Callback(hObject, eventdata, handles)
% hObject    handle to check_uni (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 check_uni


unimodal=get(hObject,'Value');

if unimodal==1;
    set(handles.radio_Cuni,'enable','on');
    set(handles.radio_Suni,'enable','on');
    set(handles.radio_CSuni,'enable','on');
else
    set(handles.radio_Cuni,'enable','off','value',0);
    set(handles.radio_Suni,'enable','off','value',0);
    set(handles.radio_CSuni,'enable','off','value',0); 
    
    set(handles.text_iuni,'enable','off');
    set(handles.popup_iuni,'enable','off','value',1);
    set(handles.text_tolunic,'enable','off');
    set(handles.edit_tolunic,'enable','off','string',' ');
    set(handles.text_tolunis,'enable','off');
    set(handles.edit_tolunis,'enable','off','string',' ');
    
    set(handles.text_ncuni,'enable','off');
    set(handles.popup_ncuni,'enable','off','value',1);
    set(handles.text_nsuni,'enable','off');
    set(handles.popup_nsuni,'enable','off','value',1);
    
    set(handles.text_spunic,'enable','off');
    set(handles.edit_spunic,'enable','off','string',' ');
    
    set(handles.text_spunis,'enable','off');
    set(handles.edit_spunis,'enable','off','string',' ');
    
    evalin('base','als_opt=rmfield(als_opt,''unimod'');');
    
end;

assignin('base','unimodal',unimodal);
evalin('base','als_opt.unimod.unimodal=unimodal;');
evalin('base','clear unimodal');


% --- Executes on button press in radio_Cuni.
function radio_Cuni_Callback(hObject, eventdata, handles)
% hObject    handle to radio_Cuni (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 radio_Cuni

imod=1;
set(handles.radio_Cuni,'enable','on');
set(handles.radio_Suni,'enable','off');
set(handles.radio_CSuni,'enable','off');
set(handles.text_iuni,'enable','on');
set(handles.popup_iuni,'enable','on');
set(handles.text_tolunic,'enable','on');
set(handles.edit_tolunic,'enable','on');
set(handles.text_ncuni,'enable','on');
set(handles.popup_ncuni,'enable','on');

assignin('base','imod',imod);
evalin('base','als_opt.unimod.imod=imod;');
evalin('base','clear imod');

% --- Executes on button press in radio_Suni.
function radio_Suni_Callback(hObject, eventdata, handles)
% hObject    handle to radio_Suni (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 radio_Suni

imod=2;
set(handles.radio_Cuni,'enable','off');
set(handles.radio_Suni,'enable','on');
set(handles.radio_CSuni,'enable','off');
set(handles.text_iuni,'enable','on');
set(handles.popup_iuni,'enable','on');
set(handles.text_tolunis,'enable','on');
set(handles.edit_tolunis,'enable','on');
set(handles.text_nsuni,'enable','on');
set(handles.popup_nsuni,'enable','on');

assignin('base','imod',imod);
evalin('base','als_opt.unimod.imod=imod;');
evalin('base','clear imod');


% --- Executes on button press in radio_CSuni.
function radio_CSuni_Callback(hObject, eventdata, handles)
% hObject    handle to radio_CSuni (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 radio_CSuni

imod=3;
set(handles.radio_Cuni,'enable','off');
set(handles.radio_Suni,'enable','off');
set(handles.radio_CSuni,'enable','on');

set(handles.text_iuni,'enable','on');
set(handles.popup_iuni,'enable','on');

set(handles.text_ncuni,'enable','on');
set(handles.popup_ncuni,'enable','on');
set(handles.text_nsuni,'enable','on');
set(handles.popup_nsuni,'enable','on');
set(handles.text_tolunic,'enable','on');
set(handles.edit_tolunic,'enable','on');

set(handles.text_spunic,'enable','off');
set(handles.edit_spunic,'enable','off');
set(handles.text_spunis,'enable','off');
set(handles.edit_spunis,'enable','off');
set(handles.text_tolunis,'enable','on');
set(handles.edit_tolunis,'enable','on');

assignin('base','imod',imod);
evalin('base','als_opt.unimod.imod=imod;');
evalin('base','clear imod');


% --- Executes during object creation, after setting all properties.
function popup_iuni_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popup_iuni (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

llista(1)={'select...'};
llista(2)={'vertical'};
llista(3)={'horizontal'};
llista(4)={'average'};
set(hObject,'string',llista)

% --- Executes on selection change in popup_iuni.
function popup_iuni_Callback(hObject, eventdata, handles)
% hObject    handle to popup_iuni (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popup_iuni contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popup_iuni

cmod=get(hObject,'Value')-2; 
assignin('base','cmod',cmod);
evalin('base','als_opt.unimod.cmod=cmod;');
evalin('base','clear cmod');

% --- Executes during object creation, after setting all properties.
function popup_ncuni_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popup_ncuni (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

dim=evalin('base','min(size(als_opt.iniesta))');
j=2;
llistannc(1)={'select...'};
for i=0:1:dim;
    llistnnc=[i];
    llistannc(j)={llistnnc};
    j=j+1;
end;

set(hObject,'string',llistannc)

% --- Executes on selection change in popup_ncuni.
function popup_ncuni_Callback(hObject, eventdata, handles)
% hObject    handle to popup_ncuni (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popup_ncuni contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popup_ncuni
% --- Executes during object creation, after setting all properties.


nmod=get(hObject,'Value')-2; 

dim=evalin('base','min(size(als_opt.iniesta))');
nexp=evalin('base','als_opt.nexp');

if nmod == dim
    spmod=ones(1,dim);
    set(handles.text_spunic,'enable','off');
    set(handles.edit_spunic,'enable','off','string','');
elseif  nmod == 0
    spmod=zeros(1,dim);
    set(handles.text_spunic,'enable','off');
    set(handles.edit_spunic,'enable','off','string','');   
elseif  nmod == -1
    spmod=[];
    set(handles.text_spunic,'enable','off');
    set(handles.edit_spunic,'enable','off','string','');
else
    spmod=[];
    set(handles.text_spunic,'enable','on');
    set(handles.edit_spunic,'enable','on'); 

⌨️ 快捷键说明

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