% %function [] = myprova(Dati_tmp) function [] = myprova() % Demonstrate how to tell which button in a uibuttongroup is selected. % Similar to GUI_6 except that a uibuttongroup which enforces exclusivity % is used. % % Suggested exercise: Make the editbox change the selected radiobutton. % Be sure to check that user input is valid. clc close all global vett_str_pp_in; x_Sfh=0; %dovuto 0,0 in alto a sinistra y_Sfh=0; l_Sfh=1230; l_Sfh=710; h_Sfh=750; pos_Sfh=[x_Sfh y_Sfh l_Sfh h_Sfh]; %figura totale S.fh = figure('units','pixels',... 'position',pos_Sfh,... 'menubar','none',... 'name','Gruppo AMR',... 'numbertitle','off',... 'resize','off'); set(S.fh,'windowbuttonmotionfcn',{@fh_wbmfcn,S}) % Set the motion detector. %% dichiarazine riguardanti la finestra principale x_bg1=0; %dovuto che 0,0 � in basso a sinistra l_bg1=700; h_bg1=200; y_bg1=h_Sfh-h_bg1; pos_bg1=[x_bg1 y_bg1 l_bg1 h_bg1]; %cornice per disattivare parte selezione variabili S.bg1 = uibuttongroup('parent',S.fh,'units','pix',... 'pos',pos_bg1); WB = waitbar(0,'loading...','position',[222,222,290,60]) ; %load('Dati_Matrice.mat'); Dati_vi = getappdata(0,'Dati_vi'); Dati_ch = getappdata(0,'Dati_ch'); Dati_id = getappdata(0,'Dati_id'); waitbar(0.5,WB) % % x_bg2=l_bg1; %dovuto che 0,0 � in basso a sinistra % % l_bg2=500; % % h_bg2=200; % % y_bg2=h_Sfh-h_bg2; % % pos_bg2=[x_bg2 y_bg2 l_bg2 h_bg2]; % % %cornice per disattivare parte selezione variabili % % S.bg2 = uibuttongroup('parent',S.fh,'units','pix',... % % 'pos',pos_bg2); % % % % x_bg3=0; %dovuto che 0,0 � in basso a sinistra % % y_bg3=0; % % l_bg3=500; % % h_bg3=300; % % pos_bg3=[x_bg3 y_bg3 l_bg3 h_bg3]; % % %cornice per disattivare parte selezione variabili % % S.bg3 = uibuttongroup('parent',S.fh,'units','pix',... % % 'pos',pos_bg3); % % % % x_bg4=l_bg3; %dovuto che 0,0 � in basso a sinistra % % y_bg4=0; % % l_bg4=500; % % h_bg4=300; % % pos_bg4=[x_bg4 y_bg4 l_bg4 h_bg4]; % % %cornice per disattivare parte selezione variabili % % S.bg4 = uibuttongroup('parent',S.fh,'units','pix',... % % 'pos',pos_bg4); %% dichiarazioni bg1 metodi={ 'null' 'sseh_yy' 'sseh_ny' 'n4sid' 'ssglar' 'glar' 'pem' }; x_pp_met=5; h_pp_met=20; l_pp_met=100; y_pp_met=h_bg1-h_pp_met-30; pos_pp_met=[x_pp_met y_pp_met l_pp_met h_pp_met]; %menu a tendina scelta del algoritmo S.pp_met = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_met,... 'string',metodi); % % dichiarazione che serve per prendere i dati dal vettore Dati_vi = getappdata(0,'Dati_vi'); lun_dati_vi=length(Dati_vi)+1; sign_vi=zeros(1,50); for i=1:lun_dati_vi-1 sign_vi(i)=Dati_vi(i).id; end vett_str_pp_in_vi={ 'null' num2str(sign_vi(1)) num2str(sign_vi(2)) num2str(sign_vi(3)) num2str(sign_vi(4)) num2str(sign_vi(5)) num2str(sign_vi(6)) num2str(sign_vi(7)) num2str(sign_vi(8)) num2str(sign_vi(9)) num2str(sign_vi(10)) num2str(sign_vi(11)) num2str(sign_vi(12)) num2str(sign_vi(13)) num2str(sign_vi(14)) num2str(sign_vi(15)) num2str(sign_vi(16)) num2str(sign_vi(17)) num2str(sign_vi(18)) num2str(sign_vi(19)) num2str(sign_vi(20)) num2str(sign_vi(21)) num2str(sign_vi(22)) num2str(sign_vi(23)) num2str(sign_vi(24)) num2str(sign_vi(25)) num2str(sign_vi(26)) num2str(sign_vi(27)) num2str(sign_vi(28)) num2str(sign_vi(29)) num2str(sign_vi(30)) }; sensori=vett_str_pp_in_vi(1:lun_dati_vi); x_pp_in=x_pp_met+l_pp_met+5; y_pp_in=y_pp_met; h_pp_in=h_pp_met; l_pp_in=l_pp_met; pos_pp_in=[x_pp_in y_pp_in l_pp_in h_pp_in]; S.pp_in = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_in,... 'string',sensori,'enable','off'); tipomis={ 'null' 'temperature' 'humidity'}; l_pp_ht=l_pp_in+20; x_pp_ht=x_pp_in+l_pp_in+5; y_pp_ht=y_pp_in; h_pp_ht=h_pp_in; pos_pp_ht=[x_pp_ht y_pp_ht l_pp_ht h_pp_ht]; S.pp_ht = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_ht,... 'string',tipomis); tipo_edificio={ 'null' 'vicenza' 'chiuso'}; l_pp_ed=l_pp_in; x_pp_ed=x_pp_ht+l_pp_ht+5; y_pp_ed=y_pp_in; h_pp_ed=h_pp_in; pos_pp_ed=[x_pp_ed y_pp_ed l_pp_ed h_pp_ed]; %selezione edificio S.pp_ed = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_ed,... 'string',tipo_edificio); y_pp_met=y_pp_met+20; pos_pp_met=[x_pp_met y_pp_met l_pp_met h_pp_met]; %scritta sopra il men� a tendina S.tx_met = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_met,... 'string','metodi'); y_pp_in=y_pp_in+20; pos_pp_in=[x_pp_in y_pp_in l_pp_in h_pp_in]; S.tx_in = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_in,... 'string','sensore'); y_pp_ht=y_pp_ht+20; pos_pp_ht=[x_pp_ht y_pp_ht l_pp_ht h_pp_ht]; S.tx_ht = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_ht,... 'string','tipo segnale'); y_pp_ed=y_pp_ed+20; pos_pp_ed=[x_pp_ed y_pp_ed l_pp_ed h_pp_ed]; S.tx_ed = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_ed,... 'string','edificio'); %creazione del bottone inizializzazione S.push_init = uicontrol('parent',S.bg1,'style','push',... 'units','pixels',... 'position',[0 0 90 25],... 'fontsize',8,... 'string','Inizializzazione'); %creazioen del bottone calcola %non subito visibile S.push_calc = uicontrol('parent',S.bg1,'style','push',... 'units','pixels',... 'position',[90 0 90 25],... 'fontsize',8,... 'string','Illustra','enable','off'); %% scelta sshe di p ed n [len_p len_n]=size(Dati_vi(1).t.sseh_yy); p=zeros(1,30); n=zeros(1,30); %calcolo quanti segnali sono presenti nella nostra struttura for i=1:len_p p(i)= Dati_vi(1).t.sseh_yy(i,1).p_; end for i=1:len_n n(i)= Dati_vi(1).t.sseh_yy(1,i).n_; end % converto in stringa i numeri n_str={ num2str(n(1)) num2str(n(2)) num2str(n(3)) num2str(n(4)) num2str(n(5)) num2str(n(6)) num2str(n(7)) num2str(n(8)) num2str(n(9)) num2str(n(10)) }; p_str={ num2str(p(1)) num2str(p(2)) num2str(p(3)) num2str(p(4)) num2str(p(5)) num2str(p(6)) num2str(p(7)) num2str(p(8)) num2str(p(9)) num2str(p(10)) }; n_str=n_str(1:len_n); p_str=p_str(1:len_p); pos_pp_sseh_n=[100 100 100 10]; S.pp_sseh_n = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_sseh_n,... 'string',n_str,'enable','off'); pos_pp_sseh_p=[100 80 100 10]; S.pp_sseh_p = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_sseh_p,... 'string',p_str,'enable','off'); pos_pp_sseh_k=[100 40 100 30]; S.pp_sseh_k = uicontrol('parent',S.bg1,'style','edit',... 'units','pixels',... 'position',pos_pp_sseh_k,... 'enable','on','string','10'); pos_pp_sseh_n=[80 96 20 12]; pos_pp_sseh_p=[80 74 20 16]; pos_pp_sseh_k=[80 50 20 12]; S.tx_pp_sseh_p = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_sseh_p,... 'string','p'); S.tx_pp_sseh_p = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_sseh_n,... 'string','n'); S.tx_pp_sseh_p = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_pp_sseh_k,... 'string','k'); %numero grafico pos_pp_figure1=[350 100 100 20]; vett_str_pp_figure1={ '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '30' }; S.pp_figure1 = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_figure1,... 'string',vett_str_pp_figure1,'enable','on'); pos_pp_figure2=[350 80 100 20]; vett_str_pp_figure2={ '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '30' }; S.pp_figure2 = uicontrol('parent',S.bg1,'style','pop',... 'units','pixels',... 'position',pos_pp_figure2,... 'string',vett_str_pp_figure2,'enable','on'); pos_tx_figure=[350 122 100 16]; S.tx_pp_figure = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_tx_figure,... 'string','Number Figure'); %% dichiarazioni delle call set(S.pp_met,'callback',{@pp_met_call,S}); % Set the callback. set(S.pp_in,'callback',{@pp_in_call,S}); % Set the callback. set(S.pp_ht,'callback',{@pp_ht_call,S}); % Set the callback. set(S.pp_ed,'callback',{@pp_ed_call,S}); % Set the callback. set(S.pp_figure1,'callback',{@pp_figure1_call,S}) % Set callbacks. set(S.push_init,'callback',{@push_init_call,S}) % Set callbacks. set(S.push_calc,'callback',{@push_calc_call,S}) % Set callbacks. %set(S.fh,'windowbuttonmotionfcn',{@fh_wbmfcn,S}) % Set the motion detector. %% dichiarazioni di bg2 % % S.FigRic(1) = axes('parent',S.fh,'units','pixels',... % % 'position',[525 20 650 220],... % % 'fontsize',8,... % % 'visible','on'); % % % % S.FigRic(2) = axes('parent',S.fh,'units','pixels',... % % 'position',[525 260 650 220],... % % 'fontsize',8,... % % 'visible','on'); % % % % S.FigRic(3) = axes('parent',S.fh,'units','pixels',... % % 'position',[525 500 650 220],... % % 'fontsize',8,... % % 'visible','on'); pos_fit=[525 170 40 16]; S.tx_fit = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_fit,... 'string','Fit:'); pos_spar=[510 150 55 16]; S.tx_spar = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_spar,... 'string','Sparsity:'); pos_use_t=[510 130 55 16]; S.tx_use_t = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_use_t,... 'string','Use t:'); pos_use_h=[510 110 55 16]; S.tx_use_h = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_use_h,... 'string','Use h:'); pos_use_ir=[510 90 55 16]; S.tx_use_ir = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_use_ir,... 'string','Use ir:'); pos_use_ir=[500 70 65 16]; S.tx_use_ir = uicontrol('parent',S.bg1,'style','text',... 'units','pixels',... 'position',pos_use_ir,... 'string','Rms/Cod:'); %% dichiarazioni di bg3 S.PosSens = axes('parent',S.fh,'units','pixels',... 'position',[20 20 680 500],... 'fontsize',8,... 'visible','on'); set(S.PosSens,'buttondownfcn',{@PosSens_click,S}); %set(S.fh,'windowbuttonmotionfcn',{@fh_wbmfcn,S}) % Set the motion detector. %% dichiarazioni di bg4 %% for i=51:75 waitbar(i/100,WB) end waitbar(1, WB) ; delete(WB) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [] = pp_met_call(varargin) %% selezione del metodo S = varargin{3}; % Get the structure. popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); %attivo pulsante calc if popup_sel_index_pp_met~=1 && popup_sel_index_pp_in~=1 && popup_sel_index_pp_ht~=1 && popup_sel_index_pp_ed~=1 set(S.push_calc,'enable','on'); end; %attivo o meno i paremetri del sseh if ( popup_sel_index_pp_met==2 | popup_sel_index_pp_met==3 ) set(S.pp_sseh_n,'enable','on'); set(S.pp_sseh_p,'enable','on'); else set(S.pp_sseh_n,'enable','off'); set(S.pp_sseh_p,'enable','off'); end; popup_enable_pp_met = get(S.pp_met, 'enable'); popup_enable_pp_in = get(S.pp_in, 'enable'); popup_enable_pp_ht = get(S.pp_ht, 'enable'); popup_enable_pp_ed = get(S.pp_ed, 'enable'); on='on'; bln_met = strcmp(popup_enable_pp_met,on); bln_in = strcmp(popup_enable_pp_in,on); bln_ht = strcmp(popup_enable_pp_ht,on); bln_ed = strcmp(popup_enable_pp_ed,on); boolean=( bln_met && bln_in && bln_ht && bln_ed); if boolean set(S.push_calc,'enable','on'); else set(S.push_calc,'enable','off'); end if popup_sel_index_pp_met==1 || popup_sel_index_pp_in==1 || popup_sel_index_pp_ht==1 || popup_sel_index_pp_ed==1 set(S.push_calc,'enable','off'); end function [] = pp_in_call(varargin) %% selezione dell'ingresso % % % Callback for the popup. S = varargin{3}; % Get the structure. popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); if popup_sel_index_pp_met~=1 && popup_sel_index_pp_in~=1 && popup_sel_index_pp_ht~=1 && popup_sel_index_pp_ed~=1 set(S.push_calc,'enable','on'); end; popup_enable_pp_met = get(S.pp_met, 'enable'); popup_enable_pp_in = get(S.pp_in, 'enable'); popup_enable_pp_ht = get(S.pp_ht, 'enable'); popup_enable_pp_ed = get(S.pp_ed, 'enable'); on='on'; bln_met = strcmp(popup_enable_pp_met,on); bln_in = strcmp(popup_enable_pp_in,on); bln_ht = strcmp(popup_enable_pp_ht,on); bln_ed = strcmp(popup_enable_pp_ed,on); boolean=( bln_met && bln_in && bln_ht && bln_ed); if boolean set(S.push_calc,'enable','on'); else set(S.push_calc,'enable','off'); end if popup_sel_index_pp_met==1 || popup_sel_index_pp_in==1 || popup_sel_index_pp_ht==1 || popup_sel_index_pp_ed==1 set(S.push_calc,'enable','off'); end function [] = pp_ht_call(varargin) %% seletore temperatura umidit� % % % Callback for the popup. S = varargin{3}; % Get the structure. popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); if popup_sel_index_pp_met~=1 && popup_sel_index_pp_in~=1 && popup_sel_index_pp_ht~=1 && popup_sel_index_pp_ed~=1 set(S.push_calc,'enable','on'); end; popup_enable_pp_met = get(S.pp_met, 'enable'); popup_enable_pp_in = get(S.pp_in, 'enable'); popup_enable_pp_ht = get(S.pp_ht, 'enable'); popup_enable_pp_ed = get(S.pp_ed, 'enable'); on='on'; bln_met = strcmp(popup_enable_pp_met,on); bln_in = strcmp(popup_enable_pp_in,on); bln_ht = strcmp(popup_enable_pp_ht,on); bln_ed = strcmp(popup_enable_pp_ed,on); boolean=( bln_met && bln_in && bln_ht && bln_ed); if boolean set(S.push_calc,'enable','on'); else set(S.push_calc,'enable','off'); end; if popup_sel_index_pp_met==1 || popup_sel_index_pp_in==1 || popup_sel_index_pp_ht==1 || popup_sel_index_pp_ed==1 set(S.push_calc,'enable','off'); end; function [] = pp_ed_call(varargin) %% funzione pop edificio ridimensiono i vettori ingressi % % % Callback for the popup. S = varargin{3}; % Get the structure. popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); %ridimensione edificio Dati_vi = getappdata(0,'Dati_vi'); Dati_ch = getappdata(0,'Dati_ch'); lun_dati_vi=length(Dati_vi)+1; lun_dati_ch=length(Dati_ch)+1; sign_vi=zeros(1,50); sign_ch=zeros(1,50); for i=1:lun_dati_vi-1 sign_vi(i)=Dati_vi(i).id; end for i=1:lun_dati_ch-1 sign_ch(i)=Dati_ch(i).id; end vett_str_pp_in_vi={ 'null' num2str(sign_vi(1)) num2str(sign_vi(2)) num2str(sign_vi(3)) num2str(sign_vi(4)) num2str(sign_vi(5)) num2str(sign_vi(6)) num2str(sign_vi(7)) num2str(sign_vi(8)) num2str(sign_vi(9)) num2str(sign_vi(10)) num2str(sign_vi(11)) num2str(sign_vi(12)) num2str(sign_vi(13)) num2str(sign_vi(14)) num2str(sign_vi(15)) num2str(sign_vi(16)) num2str(sign_vi(17)) num2str(sign_vi(18)) num2str(sign_vi(19)) num2str(sign_vi(20)) num2str(sign_vi(21)) num2str(sign_vi(22)) num2str(sign_vi(23)) num2str(sign_vi(24)) num2str(sign_vi(25)) num2str(sign_vi(26)) num2str(sign_vi(27)) num2str(sign_vi(28)) num2str(sign_vi(29)) num2str(sign_vi(30)) }; vett_str_pp_in_ch={ 'null' num2str(sign_ch(1)) num2str(sign_ch(2)) num2str(sign_ch(3)) num2str(sign_ch(4)) num2str(sign_ch(5)) num2str(sign_ch(6)) num2str(sign_ch(7)) num2str(sign_ch(8)) num2str(sign_ch(9)) num2str(sign_ch(10)) num2str(sign_ch(11)) num2str(sign_ch(12)) num2str(sign_ch(13)) num2str(sign_ch(14)) num2str(sign_ch(15)) num2str(sign_ch(16)) num2str(sign_ch(17)) num2str(sign_ch(18)) num2str(sign_ch(19)) num2str(sign_ch(20)) num2str(sign_ch(21)) num2str(sign_ch(22)) num2str(sign_ch(23)) num2str(sign_ch(24)) num2str(sign_ch(25)) num2str(sign_ch(26)) num2str(sign_ch(27)) num2str(sign_ch(28)) num2str(sign_ch(29)) num2str(sign_ch(30)) }; if popup_sel_index_pp_ed==2 set(S.pp_in,'enable','on'); sensori=vett_str_pp_in_vi(1:lun_dati_vi); set(S.pp_in,'string',sensori); elseif popup_sel_index_pp_ed==3 set(S.pp_in,'enable','on'); sensori=vett_str_pp_in_ch(1:lun_dati_ch); set(S.pp_in,'string',sensori); else set(S.pp_in,'enable','off'); end if popup_sel_index_pp_met~=1 && popup_sel_index_pp_in~=1 && popup_sel_index_pp_ht~=1 && popup_sel_index_pp_ed~=1 set(S.push_calc,'enable','on'); end if popup_sel_index_pp_met==1 || popup_sel_index_pp_in==1 || popup_sel_index_pp_ht==1 || popup_sel_index_pp_ed==1 set(S.push_calc,'enable','off'); end popup_enable_pp_met = get(S.pp_met, 'enable'); popup_enable_pp_in = get(S.pp_in, 'enable'); popup_enable_pp_ht = get(S.pp_ht, 'enable'); popup_enable_pp_ed = get(S.pp_ed, 'enable'); on='on'; bln_met = strcmp(popup_enable_pp_met,on); bln_in = strcmp(popup_enable_pp_in,on); bln_ht = strcmp(popup_enable_pp_ht,on); bln_ed = strcmp(popup_enable_pp_ed,on); boolean=( bln_met && bln_in && bln_ht && bln_ed); if boolean set(S.push_calc,'enable','on'); else set(S.push_calc,'enable','off'); end function [] = push_init_call(varargin) %% funzione inizializza % % % Callback for the push botton. S = varargin{1,3}; % Get the structure. popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); %forzo le variabili non inizializzate e le metto diverse da null if popup_sel_index_pp_met==1; popup_sel_index_pp_met=2; set(S.pp_sseh_n,'enable','on'); set(S.pp_sseh_p,'enable','on'); end; if popup_sel_index_pp_in==1; popup_sel_index_pp_in=2; end; if popup_sel_index_pp_ht==1; popup_sel_index_pp_ht=2; end; if popup_sel_index_pp_ed==1; popup_sel_index_pp_ed=2; end; %imposto i valori set(S.pp_met,'Value',popup_sel_index_pp_met); set(S.pp_in,'Value',popup_sel_index_pp_met); set(S.pp_ht,'Value',popup_sel_index_pp_met); set(S.pp_ed,'Value',popup_sel_index_pp_met); set(S.push_calc,'enable','on'); set(S.pp_in,'enable','on'); function [] = push_calc_call(varargin) %% calcola S = varargin{1,3}; %WB = waitbar(0,'loading...','position',[222,222,290,60]) ; %waitbar(0.25,WB); popup_sel_index_pp_met = get(S.pp_met, 'Value'); popup_sel_index_pp_in = get(S.pp_in, 'Value'); popup_sel_index_pp_ht = get(S.pp_ht, 'Value'); popup_sel_index_pp_ed = get(S.pp_ed, 'Value'); idx=popup_sel_index_pp_in-1; popup_sel_index_pp_figure1 = get(S.pp_figure1, 'Value'); popup_sel_index_pp_figure2 = get(S.pp_figure2, 'Value'); k=str2double(get(S.pp_sseh_k,'str')); idx_n=get(S.pp_sseh_n,'value'); idx_p=get(S.pp_sseh_p,'value'); fit1=0; fit=0; spar=[]; boolean_norm=true; Dati_vi = getappdata(0,'Dati_vi'); Dati_ch = getappdata(0,'Dati_ch'); Dati_id = getappdata(0,'Dati_id'); dati_plot=[]; %waitbar(0.5,WB); %scelta dell'edificio if popup_sel_index_pp_ed==2 Dati=Dati_vi; elseif popup_sel_index_pp_ed==3 Dati=Dati_ch; end %da cancellare %Dati=Dati_id; %sseh_yy if popup_sel_index_pp_met==2 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature %norm o non_nomr if boolean_norm rif = Dati(idx).t.sseh_yy(idx_p,idx_n); else rif = Dati(idx).t.sseh_yy_norm(idx_p,idx_n); end %[ y_no , fit1 , x_no ]=compare(Dati(idx).t.sseh_yy(idx_p,idx_n).dati_val,Dati(idx).t.sseh_yy(idx_p,idx_n).Mnpf,k); %[dati_plot fit] = test_validazione( Dati(idx).t.sseh_yy(idx_p,idx_n).Mnpf , Dati(idx).t.sseh_yy(idx_p,idx_n).dati_val , k); [ y_no , fit1 , x_no ]=compare(rif.dati_val,rif.Mnpf,k); [dati_plot fit] = test_validazione( rif.Mnpf , rif.dati_val , k); th='t'; yy='yy'; elseif popup_sel_index_pp_ht==3 %humidity if boolean_norm rif = Dati(idx).h.sseh_yy(idx_p,idx_n); else rif = Dati(idx).h.sseh_yy_norm(idx_p,idx_n); end [ y_no , fit1 , x_no ]=compare(Dati(idx).h.sseh_yy(idx_p,idx_n).dati_val,Dati(idx).h.sseh_yy(idx_p,idx_n).Mnpf,k); [dati_plot fit] = test_validazione( Dati(idx).h.sseh_yy(idx_p,idx_n).Mnpf , Dati(idx).h.sseh_yy(idx_p,idx_n).dati_val , k ); th='h'; yy='yy'; end %waitbar(0.75,WB); spar=accensioni( Dati,idx,idx_p,idx_n,th,yy); end %sseh_ny if popup_sel_index_pp_met==3 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature [ y_no , fit1 , x_no ]=compare(Dati(idx).t.sseh_yy(idx_p,idx_n).dati_val,Dati(idx).t.sseh_yy(idx_p,idx_n).Mnpf,k); [dati_plot fit] = test_validazione( Dati(idx).t.sseh_ny(idx_p,idx_n).Mnpf , Dati(idx).t.sseh_ny(idx_p,idx_n).dati_val , k ); th='t'; yy='ny'; elseif popup_sel_index_pp_ht==3 %humidity [ y_no , fit1 , x_no ]=compare(Dati(idx).h.sseh_yy(idx_p,idx_n).dati_val,Dati(idx).h.sseh_yy(idx_p,idx_n).Mnpf,k); [dati_plot fit] = test_validazione( Dati(idx).h.sseh_ny(idx_p,idx_n).Mnpf , Dati(idx).h.sseh_ny(idx_p,idx_n).dati_val , k ); th='h'; yy='ny'; end %waitbar(0.75,WB); spar=accensioni( Dati,idx,idx_p,idx_n,th,yy); end %n4sid_t_norm if popup_sel_index_pp_met==4 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature th='t'; [yh1, fit1, x01]=compare(Dati(idx).t.n4sid.best_mod.dati_val, Dati(idx).t.n4sid.best_mod.iden_n4sid, k); elseif popup_sel_index_pp_ht==3 %humidity th='h'; [yh1, fit1, x01]=compare(Dati(idx).h.n4sid.best_mod.dati_val, Dati(idx).h.n4sid.best_mod.iden_n4sid, k); end end %ssglar if popup_sel_index_pp_met==5 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature th='t'; [ y_no , fit1 , x_no ]=compare(Dati(idx).t.sseh_yy(idx_p,idx_n).dati_val,Dati(idx).t.sseh_yy(idx_p,idx_n).Mnpf,k); elseif popup_sel_index_pp_ht==3 %humidity th='h'; end end %glar if popup_sel_index_pp_met==6 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature th='t'; elseif popup_sel_index_pp_ht==3 %humidity th='h'; end end %pem if popup_sel_index_pp_met==7 figure(popup_sel_index_pp_figure2+1) if popup_sel_index_pp_ht==2 %temperature th='t'; elseif popup_sel_index_pp_ht==3 %humidity th='h'; end end %denormalizzaione dei dati per il normale plottagio if popup_sel_index_pp_met==2 || popup_sel_index_pp_met==3 if popup_sel_index_pp_ht==2 dati_plot(:,1)=dati_plot(:,1)*var(Dati(idx).t.y_org)^(1/2)+mean(Dati(idx).t.y_org); dati_plot(:,2)=dati_plot(:,2)*var(Dati(idx).t.y_org)^(1/2)+mean(Dati(idx).t.y_org); elseif popup_sel_index_pp_ht==3 dati_plot(:,1)=dati_plot(:,1)*var(Dati(idx).h.y_org)^(1/2)+mean(Dati(idx).h.y_org); dati_plot(:,2)=dati_plot(:,2)*var(Dati(idx).h.y_org)^(1/2)+mean(Dati(idx).h.y_org); end end %scrivo i fit pos_fit_val1=[565 170 60 16]; pos_fit_val2=[620 170 60 16]; S.tx_fit_val1 = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_fit_val1,'string',[num2str(fit,4) '%']); S.tx_fit_val2 = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_fit_val2,'string',[num2str(fit1,4) '%']); %calcolo sparsità size_spar=size(spar); tot_spar=size_spar(1)*size_spar(2); spar_str=num2str(100-sum(sum(spar))/tot_spar*100,4); spar_str=[spar_str '%']; pos_spar_val=[565 150 60 16]; S.tx_spar_val = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_spar_val,'string',spar_str); %definizio delle posizoni pos_use_t_val=[565 130 55 16]; pos_use_h_val=[565 110 55 16]; pos_use_ir_val=[565 90 55 16]; pos_use_t_val_p=[620 130 55 16]; pos_use_h_val_p=[620 110 55 16]; pos_use_ir_val_p=[620 90 55 16]; pos_use_rms=[565 70 55 16]; pos_use_cod=[620 70 55 16]; %seleziono discrivere la sparsità solo per gli sseh if popup_sel_index_pp_met==2 || popup_sel_index_pp_met==3 num_t=num2str(sum(spar(1,:))); l=length(Dati); ln=num2str(length(Dati)); num_t=[num_t '/' ln]; num_h=num2str(sum(spar(2,:))); num_h=[num_h '/' ln]; num_ir=num2str(sum(spar(3,:))); num_ir=[num_ir '/' ln]; num_t_p=num2str(sum(spar(1,:))/l*100,4); num_t_p=[num_t_p '%']; num_h_p=num2str(sum(spar(2,:))/l*100,4); num_h_p=[num_h_p '%']; num_ir_p=num2str(sum(spar(3,:))/l*100,4); num_ir_p=[num_ir_p '%']; rms = sqrt(mean((dati_plot(:,1)-dati_plot(:,2)).^2)); mse = rms^2; cod = num2str(abs(1 - rms^2 / (mean((dati_plot(:,1)-mean(dati_plot(:,2))).^2))),4); rms = num2str(rms,4); else num_t=['nd/']; num_h=['nd/']; num_ir=['nd/']; num_t_p=['nd/']; num_h_p=['nd/']; num_ir_p=['nd/']; rms=['nd/']; ems=['nd/']; cod=['nd/']; end %scivo i dati sparsità S.tx_use_t_val = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_t_val,'string',num_t); S.tx_use_h_val = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_h_val,'string',num_h); S.tx_use_ir_val = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_ir_val,'string',num_ir); S.tx_use_t_val_p = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_t_val_p,'string',num_t_p); S.tx_use_h_val_p = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_h_val_p,'string',num_h_p); S.tx_use_ir_val_p = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_ir_val_p,'string',num_ir_p); % % % da qui cacolo gli indici RMS_k COD_k MSE S.tx_use_rms = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_rms,'string',rms); S.tx_use_cod = uicontrol('parent',S.bg1,'style','text','units','pixels','position',pos_use_cod,'string',cod); % funzione che richiama il disegno dell'edificio Size_spar=size(spar); Sum_spar=sum(Size_spar); if Sum_spar<11 else disp_sens(spar,1,idx,th); % uno perchè disegna nell'interfaccia end %figura su cui plottare, non leggo il numero ma l'indice del %popmenu e poi lo implemento 1 if popup_sel_index_pp_met==2 || popup_sel_index_pp_met==3 figure(popup_sel_index_pp_figure1+1); plot(dati_plot); legend('y misurata','y validazione','position','thebest') end %delete(WB); function [] = PosSens_click(varargin) S = varargin{1,3}; figure; clf x=[1:0.001:10]; y=sin(x); plot(y); function []=fh_wbmfcn(varargin) S = varargin{1,3};