plotpdf_evalfunc.m 1000 Bytes
%Function that plots and saves the figure of the estimated pdf of the evaluation function
%for the chosen variable. 

function plotpdf_evalfunc(handles,hObject,handles1)
    try
        load(fullfile(handles1.folder,handles1.chosen_variable,'pdf_eval_func.mat'));
        for i=1:size(xbinT,1)
            plot(handles.axes2,xbinT(i,:),ks_y_T(i,:));
            hold on
        end
        xlabel(handles1.chosen_variable,'Interpreter','none');
        ylabel('pdf of evaluation function');
        
        fh = figure('Visible','off');
        h_new=copyobj(handles.axes2, fh);
        %set(h_new,'Position',get(0,'DefaultAxesPosition'));
        set(h_new, 'Units', 'Normalized');
        set(h_new,'OuterPosition',[.1, .1, .85, .85]);
        set(gcf,'Visible','off','CreateFcn','set(gcf,''Visible'',''on'')')
        saveas(fh, fullfile(handles1.folder,handles1.chosen_variable,handles1.chosen_variable),'jpeg');
        close(fh);
        
    catch ME
        errordlg(ME.message) 
    end
end