Tuesday, August 22, 2017

TAPIS DIGITAL ELIP DAN BUTTERWORTH UNTUK AUDIO DIGITAL



















KODE SUMBER GUI MATLAB:

function varargout = Tapis_Digital_Audio(varargin)
% Tapis_Digital_Audio M-file for Tapis_Digital_Audio.fig
%      Tapis_Digital_Audio, by itself, creates a new Tapis_Digital_Audio or raises the existing
%      singleton*.
%
%      H = Tapis_Digital_Audio returns the handle to a new Tapis_Digital_Audio or the handle to
%      the existing singleton*.
%
%      Tapis_Digital_Audio('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in Tapis_Digital_Audio.M with the given input arguments.
%
%      Tapis_Digital_Audio('Property','Value',...) creates a new Tapis_Digital_Audio or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_FILTER_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Tapis_Digital_Audio_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

% Copyright 2002-2003 The MathWorks, Inc.

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

% Last Modified by GUIDE v2.5 21-Jul-2017 23:51:11

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Tapis_Digital_Audio_OpeningFcn, ...
                   'gui_OutputFcn',  @Tapis_Digital_Audio_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 Tapis_Digital_Audio is made visible.
function Tapis_Digital_Audio_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   command line arguments to Tapis_Digital_Audio (see VARARGIN)

% Choose default command line output for Tapis_Digital_Audio

set(handles.textStatic1,'String','Low Frek(Hz):');
set(handles.textStatic2,'Visible','Off');
set(handles.editF2,'Visible','Off');
handles.TapisTerseleksi = 1;

set(handles.textStatic3,'String','Low Frek(Hz):');
set(handles.textStatic4,'Visible','Off');
set(handles.editF4,'Visible','Off');
handles.TapisTerseleksi2 = 1;

set(handles.textStatic7,'String','Low Frek(Hz):');
set(handles.textStatic8,'Visible','Off');
set(handles.editF8,'Visible','Off');
handles.TapisTerseleksi4 = 1;

set(handles.sliderSNR,'Min',-35);
set(handles.sliderSNR,'Max', 15);
handles.SNR = (get(handles.sliderSNR,'Value'));
set(handles.editSNR, 'String', [num2str(handles.SNR) ' dB SNR'] );

handles.fileDimuat = 0;
handles.fileBerderau = 0;
handles.fileFinal = 0;

handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Tapis_Digital_Audio_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 button press in tombolMuat.
function tombolMuat_Callback(hObject, eventdata, handles)
% hObject    handle to tombolMuat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

[NamaFile,NamaPath] = uigetfile({'*.wav'},'Muat File Wav');
[x,Fs] = wavread([NamaPath '/' NamaFile]);
handles.x = x ./ max(abs(x));
handles.Fs = Fs;
axes(handles.sumbuSinyal1);
waktu = 0:1/Fs:(length(handles.x)-1)/Fs;
plot(waktu, handles.x);
axis([0 max(waktu) -1 1]);
axes(handles.sumbuSpektrum1);
specgram(handles.x, 1024, handles.Fs);
title('Spektrum Sinyal');
handles.fileDimuat = 1;

axes(handles.sumbuSpektrumDerau); cla;
axes(handles.sumbuSpektrum2); cla;
axes(handles.sumbuSpektrumAkhir); cla;

handles.fileBerderau = 0;
handles.fileFinal = 0;

set(handles.edit4, 'String', num2str(Fs));
set(handles.edit5, 'String', num2str(length(handles.x)));

guidata(hObject, handles);

% --- Executes on button press in tombolPlay.
function tombolPlay_Callback(hObject, eventdata, handles)
% hObject    handle to tombolPlay (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if (handles.fileDimuat==1)
    sound(handles.x, handles.Fs);
end



% --- 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 = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
S = get(hObject,'Value');

switch (S)
    case (1)
        set(handles.textStatic1,'String','Low Freq (HZ):');
        set(handles.textStatic2,'Visible','Off');
        set(handles.editF2,'Visible','Off');
        handles.TapisTerseleksi = 1;
    case (2)
        set(handles.textStatic1,'String','High Freq (HZ):');
        set(handles.textStatic2,'Visible','Off');
        set(handles.editF2,'Visible','Off');
        handles.TapisTerseleksi = 2;      
    case (3)
        set(handles.textStatic1,'String','Low Freq (HZ):');
        set(handles.textStatic2,'Visible','On');
        set(handles.editF2,'Visible','On');
        set(handles.textStatic2,'String','High Freq (HZ):');      
        handles.TapisTerseleksi = 3;
       
    case (4)
        set(handles.textStatic1,'String','Low Freq (HZ):');
        set(handles.textStatic2,'Visible','On');
        set(handles.editF2,'Visible','On');
        set(handles.textStatic2,'String','High Freq (HZ):');      
        handles.TapisTerseleksi = 4;  
end

guidata(hObject, handles);


% --- 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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



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


% --- Executes during object creation, after setting all properties.
function editF1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editF1 (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 editF2_Callback(hObject, eventdata, handles)
% hObject    handle to editF2 (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 editF2 as text
%        str2double(get(hObject,'String')) returns contents of editF2 as a double


% --- Executes during object creation, after setting all properties.
function editF2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editF2 (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




% --- Executes on button press in tombolDerau.
function tombolDerau_Callback(hObject, eventdata, handles)
% hObject    handle to tombolDerau (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if (handles.fileDimuat==1)

    Derau = 2*rand(size(handles.x)) - 1;
    N = 300;
    OK = 0;

    switch (handles.TapisTerseleksi)
        case (1)
            % Lowpass:
            Fpass  = str2num(get(handles.editF1,'String'));
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)
                    Fstop  = Fpass + 30;      
                    handles.Fpass = Fpass;
                    handles.Fstop = Fstop;
                    Hd = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (2)    
            % Highpass:
            Fpass = str2num(get(handles.editF1,'String'));          
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)              
                    Fstop  = Fpass - 30;      
                    handles.Fpass = Fpass;
                    handles.Fstop = Fstop;          
                    Hd = BangkitkanTapisHighpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (3)
            % Bandpass:
            Fpass1 = str2num(get(handles.editF1,'String'));          
            Fpass2 = str2num(get(handles.editF2,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                Fstop1 = Fpass1 - 30;                          
                Fstop2 = Fpass2 + 30;
                handles.Fpass1 = Fpass1;
                handles.Fstop1 = Fstop1;
                handles.Fpass2 = Fpass2;
                handles.Fstop2 = Fstop2;          
                Hd = BangkitkanTapisBandpass(Fpass1, Fstop1, Fpass2, Fstop2, handles.Fs, N);
                OK = 1;
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
    end
   
    if (OK==1)
        handles.fileBerderau = 1;
        handles.Hd = Hd;
        Derau = filter(Hd, 1, Derau);
        M = mean(handles.x);
        S = std(handles.x);
        SN = std(Derau);
        Derau = sqrt((1 / 10 ^ (handles.SNR/10))) * (Derau - M) * (S/SN);

        axes(handles.sumbuSpektrumDerau);
        specgram(Derau, 1024, handles.Fs);
        title('Spektrum Derau');

        handles.x2 = handles.x + Derau;

        axes(handles.sumbuSpektrum2);
        specgram(handles.x2, 1024, handles.Fs);
        title('Spektrum Sinyal Berderau');
    end
             
   
end
guidata(hObject, handles);



% --- Executes on button press in tombolPlayBerderau.
function tombolPlayBerderau_Callback(hObject, eventdata, handles)
% hObject    handle to tombolPlayBerderau (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


if (handles.fileBerderau==1)
    sound(handles.x2, handles.Fs);
end


% --- Executes on slider movement.
function sliderSNR_Callback(hObject, eventdata, handles)
% hObject    handle to sliderSNR (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

handles.SNR = (get(hObject,'Value'));
set(handles.editSNR, 'String', [sprintf('%.1f',handles.SNR) ' dB SNR'] );
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function sliderSNR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderSNR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background, change
%       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
    set(hObject,'BackgroundColor',[.9 .9 .9]);
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end





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


% --- Executes during object creation, after setting all properties.
function editSNR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editSNR (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




% --- Executes on button press in buttonDenoise.
function buttonDenoise_Callback(hObject, eventdata, handles)
% hObject    handle to buttonDenoise (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

    N = 300;

    switch (handles.TapisTerseleksi)
        case (1)
            % Lowpass --> Highpass:
            Fpass  = handles.Fstop;
            Fstop  = Fpass - 30;
            Hd_inv = BangkitkanTapisHighpass(Fpass, Fstop, handles.Fs, N);
        case (2)    
            % Highpass --> Lowpass:
            Fpass = handles.Fstop;
            Fstop = Fpass + 30;
            Hd_inv = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
        case (3)
            % Bandpass:
            Fpass1 = handles.Fstop1;
            Fstop1 = Fpass1 + 30;              
            Fpass2 = handles.Fstop2;
            Fstop2 = Fpass2 - 30;
            Hd_inv = BangkitkanTapisBandStop(Fpass1, Fstop1, Fpass2, Fstop2, handles.Fs, N);
    end

axes(handles.sumbuTapis);
%Hd_inv = inverseFilter(handles.Hd, handles.Fs,1,0);
[F,w] = freqz(Hd_inv, 1 , 1000, handles.Fs);

semilogy(w,abs(F),'b-','linewidth',2)
%set(h,'linewidth',3)

handles.Hd_inv = Hd_inv;
xFinal = filter(handles.Hd_inv, 1, handles.x2);

handles.xFinal = xFinal / max(abs(xFinal));

axes(handles.sumbuSpektrumAkhir);
specgram(handles.xFinal, 1024, handles.Fs);
handles.fileFinal = 1;


[M,N]=size(handles.xFinal);
err = sum((handles.x-handles.xFinal).^2)/(M*M);
MSE=sqrt(err);
NILMAKS=65535;
PSNR = 20*log10(NILMAKS/MSE);

set(handles.edit6, 'String', num2str(MSE));
set(handles.edit7, 'String', num2str(PSNR));


guidata(hObject, handles);


% --- Executes on button press in tombolPlayAkhir.
function tombolPlayAkhir_Callback(hObject, eventdata, handles)
% hObject    handle to tombolPlayAkhir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if(handles.fileFinal==1)
    sound(handles.xFinal, handles.Fs);
end




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


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



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


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


% --- Executes on button press in tombolWiener.
function tombolWiener_Callback(hObject, eventdata, handles)
% hObject    handle to tombolWiener (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


[xwiener H] = tapiswiener(handles.x,handles.x2,handles.Fs);


handles.xFinal = xwiener / max(abs(xwiener));
[F,w] = freqz(H, 1 , 1000, handles.Fs);
axes(handles.sumbuTapis);
semilogy(w,abs(F),'b-','linewidth',2)



%Menampilkan spektrum
axes(handles.sumbuSpektrumAkhir);
specgram(handles.xFinal, 1024, handles.Fs);
handles.fileFinal = 1;


% Menghitung MSE dan PSNR
[M,N]=size(handles.xFinal);
err = sum((handles.x-handles.xFinal).^2)/(M*M);
MSE=sqrt(err);
NILMAKS=65535;
PSNR = 20*log10(NILMAKS/MSE);

set(handles.edit6, 'String', num2str(MSE));
set(handles.edit7, 'String', num2str(PSNR));

guidata(hObject, handles);


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


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



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


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


% --- Executes on button press in tapisLMS.
function tapisLMS_Callback(hObject, eventdata, handles)
% hObject    handle to tapisLMS (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

mu = 0.001;            % ukuran langkah LMS
ha = adaptfilt.lms(64,mu);
[xLMS,e] = filter(ha,handles.x2,handles.x);

handles.xFinal = xLMS / max(abs(xLMS));
[F,w] = freqz(ha.coefficients, 1 , 1000, handles.Fs);
axes(handles.sumbuTapis);
semilogy(w,abs(F),'b-','linewidth',2)



%Menampilkan spektrum
axes(handles.sumbuSpektrumAkhir);
specgram(handles.xFinal, 1024, handles.Fs);
handles.fileFinal = 1;


% Menghitung MSE dan PSNR
[M,N]=size(handles.xFinal);
err = sum((handles.x-handles.xFinal).^2)/(M*M);
MSE=sqrt(err);
NILMAKS=65535;
PSNR = 20*log10(NILMAKS/MSE);

set(handles.edit6, 'String', num2str(MSE));
set(handles.edit7, 'String', num2str(PSNR));

guidata(hObject, handles);


% --- Executes on button press in tapisRLS.
function tapisRLS_Callback(hObject, eventdata, handles)
% hObject    handle to tapisRLS (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


lam = 0.99;            % faktor forgetting rls
P0 = 10*eye(64);        % inverse matriks korelasi awal
h = adaptfilt.rls(64,lam,P0);

[xRLS,e] = filter(h,handles.x2,handles.x);

handles.xFinal = xRLS / max(abs(xRLS));
[F,w] = freqz(h.coefficients, 1 , 1000, handles.Fs);
axes(handles.sumbuTapis);
semilogy(w,abs(F),'b-','linewidth',2)



%Menampilkan spektrum
axes(handles.sumbuSpektrumAkhir);
specgram(handles.xFinal, 1024, handles.Fs);
handles.fileFinal = 1;


% Menghitung MSE dan PSNR
[M,N]=size(handles.xFinal);
err = sum((handles.x-handles.xFinal).^2)/(M*M);
MSE=sqrt(err);
NILMAKS=65535;
PSNR = 20*log10(NILMAKS/MSE);

set(handles.edit6, 'String', num2str(MSE));
set(handles.edit7, 'String', num2str(PSNR));

guidata(hObject, handles);


% --- Executes on key press with focus on popupmenu1 and none of its controls.
function popupmenu1_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- 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

S2 = get(hObject,'Value');

switch (S2)
    case (1)
        set(handles.textStatic3,'String','Low Freq (HZ):');
        set(handles.textStatic4,'Visible','Off');
        set(handles.editF4,'Visible','Off');
        handles.TapisTerseleksi2 = 1;
    case (2)
        set(handles.textStatic3,'String','High Freq (HZ):');
        set(handles.textStatic4,'Visible','Off');
        set(handles.editF4,'Visible','Off');
        handles.TapisTerseleksi2 = 2;      
    case (3)
        set(handles.textStatic3,'String','Low Freq (HZ):');
        set(handles.textStatic4,'Visible','On');
        set(handles.editF4,'Visible','On');
        set(handles.textStatic4,'String','High Freq (HZ):');      
        handles.TapisTerseleksi2 = 3;  
       
    case (4)
        set(handles.textStatic3,'String','Low Freq (HZ):');
        set(handles.textStatic4,'Visible','On');
        set(handles.editF4,'Visible','On');
        set(handles.textStatic4,'String','High Freq (HZ):');      
        handles.TapisTerseleksi2 = 4;  
end

guidata(hObject, handles);


% --- 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



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


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



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


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



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


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



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


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


% --- Executes on selection change in popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (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 popupmenu3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu3

S3 = get(hObject,'Value');

switch (S3)
    case (1)
        set(handles.textStatic5,'String','Low Freq (HZ):');
        set(handles.textStatic6,'Visible','Off');
        set(handles.editF6,'Visible','Off');
        handles.TapisTerseleksi3 = 1;
    case (2)
        set(handles.textStatic5,'String','High Freq (HZ):');
        set(handles.textStatic6,'Visible','Off');
        set(handles.editF6,'Visible','Off');
        handles.TapisTerseleksi3 = 2;      
    case (3)
        set(handles.textStatic5,'String','Low Freq (HZ):');
        set(handles.textStatic6,'Visible','On');
        set(handles.editF6,'Visible','On');
        set(handles.textStatic6,'String','High Freq (HZ):');      
        handles.TapisTerseleksi3 = 3;    
       
    case (4)
        set(handles.textStatic5,'String','Low Freq (HZ):');
        set(handles.textStatic6,'Visible','On');
        set(handles.editF6,'Visible','On');
        set(handles.textStatic6,'String','High Freq (HZ):');      
        handles.TapisTerseleksi3 = 4;  
end

guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function popupmenu3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (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 on button press in tombolCheby.
function tombolCheby_Callback(hObject, eventdata, handles)
% hObject    handle to tombolCheby (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if (handles.fileDimuat==1)
    N = 300;
    OK = 0;

    switch (handles.TapisTerseleksi3)
        case (1)
            % Lowpass:
            Fpass  = str2num(get(handles.editF5,'String'));
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)
                    handles.Fpass = Fpass;
                    [b,a] = cheby1(6,0.5,Fpass/(handles.Fs/2));
                    [h,w] = freqz(b,a);
                    %Hd = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (2)    
            % Highpass:
            Fpass = str2num(get(handles.editF5,'String'));          
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)              
                    handles.Fpass = Fpass;
                    [b,a] = cheby1(6,0.5,Fpass/(handles.Fs/2),'high');
                    [h,w] = freqz(b,a);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (3)
            % Bandpass:
            Fpass1 = str2num(get(handles.editF5,'String'));          
            Fpass2 = str2num(get(handles.editF6,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = cheby1(6,0.5,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)]);
                   [h,w] = freqz(b,a);
                   OK = 1;
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
           
        case (4)
            % Bandstop:
            Fpass1 = str2num(get(handles.editF5,'String'));          
            Fpass2 = str2num(get(handles.editF6,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = cheby1(6,0.5,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)],'stop');
                   [h,w] = freqz(b,a);
                   OK = 1;

            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
    end
   
    if (OK==1)
        axes(handles.sumbuTapis);
        %[h,w] = freqz(b,a);
        [H,F] = freqz(b,a,N,handles.Fs);
        semilogy(F,(abs(H)));
        title('Tapis Yang Dirancang');

   
        xFinal = filter(b,a,handles.x2);
        handles.xFinal = xFinal;

        axes(handles.sumbuSpektrumAkhir);
        specgram(handles.xFinal, 1024, handles.Fs);
        title('Spektrum Sinyal Penapisan');
       
        % Menghitung MSE dan PSNR
        [M,N]=size(handles.xFinal);
        err = sum((handles.x-handles.xFinal).^2)/(M*M);
        MSE=sqrt(err);
        NILMAKS=65535;
        PSNR = 20*log10(NILMAKS/MSE);

        set(handles.edit6, 'String', num2str(MSE));
        set(handles.edit7, 'String', num2str(PSNR));
       
        handles.fileFinal=1;
    end
         
   
end
guidata(hObject, handles);






% --- Executes on button press in tombolButterworth.
function tombolButterworth_Callback(hObject, eventdata, handles)
% hObject    handle to tombolButterworth (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if (handles.fileDimuat==1)
    N = 300;
    OK = 0;

    switch (handles.TapisTerseleksi2)
        case (1)
            % Lowpass:
            Fpass  = str2num(get(handles.editF3,'String'));
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)
                    handles.Fpass = Fpass;
                    [b,a] = butter(6,Fpass/(handles.Fs/2),'low');
                    [h,w] = freqz(b,a);
                    %Hd = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (2)    
            % Highpass:
            Fpass = str2num(get(handles.editF3,'String'));          
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)              
                    handles.Fpass = Fpass;
                    [b,a] = butter(6,Fpass/(handles.Fs/2),'high');
                    [h,w] = freqz(b,a);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (3)
            % Bandpass:
            Fpass1 = str2num(get(handles.editF3,'String'));          
            Fpass2 = str2num(get(handles.editF4,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = butter(6,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)]);
                   [h,w] = freqz(b,a);
                   OK = 1;
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
           
        case (4)
            % Bandstop:
            Fpass1 = str2num(get(handles.editF3,'String'));          
            Fpass2 = str2num(get(handles.editF4,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = butter(6,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)],'stop');
                   [h,w] = freqz(b,a);
                   OK = 1;

            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
    end
   
    if (OK==1)
        axes(handles.sumbuTapis);
        %[h,w] = freqz(b,a);
        [H,F] = freqz(b,a,N,handles.Fs);
        plot(F,20*log10(abs(H)))
        title('Tapis Yang Dirancang');

   
        xFinal = filter(b,a,handles.x2);
        handles.xFinal = xFinal;

        axes(handles.sumbuSpektrumAkhir);
        specgram(handles.xFinal, 1024, handles.Fs);
        title('Spektrum Sinyal Penapisan');
       
        % Menghitung MSE dan PSNR
        [M,N]=size(handles.xFinal);
        err = sum((handles.x-handles.xFinal).^2)/(M*M);
        MSE=sqrt(err);
        NILMAKS=65535;
        PSNR = 20*log10(NILMAKS/MSE);

        set(handles.edit6, 'String', num2str(MSE));
        set(handles.edit7, 'String', num2str(PSNR));
       
        handles.fileFinal=1;
    end
         
   
end
guidata(hObject, handles);




% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

close all;

% --- Executes on button press in tombolEllip.
function tombolEllip_Callback(hObject, eventdata, handles)
% hObject    handle to tombolEllip (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if (handles.fileDimuat==1)
    N = 300;
    OK = 0;

    switch (handles.TapisTerseleksi4)
        case (1)
            % Lowpass:
            Fpass  = str2num(get(handles.editF7,'String'));
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)
                    handles.Fpass = Fpass;
                    [b,a] = ellip(6,5,40,Fpass/(handles.Fs/2));
                    [h,w] = freqz(b,a);
                    %Hd = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (2)    
            % Highpass:
            Fpass = str2num(get(handles.editF7,'String'));          
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)              
                    handles.Fpass = Fpass;
                    %[z,p,k] = ellip(6,3,50,300/500,'high');
                    [b,a] = ellip(6,5,40,Fpass/(handles.Fs/2),'high');
                    [h,w] = freqz(b,a);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (3)
            % Bandpass:
            Fpass1 = str2num(get(handles.editF7,'String'));          
            Fpass2 = str2num(get(handles.editF8,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = ellip(6,5,40,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)]);
                   [h,w] = freqz(b,a);
                   OK = 1;
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
           
        case (4)
            % Bandstop:
            Fpass1 = str2num(get(handles.editF7,'String'));          
            Fpass2 = str2num(get(handles.editF8,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))          
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   %[b,a] = ellip(3,5,50,[0.2 0.6],'stop');
                   [b,a] = ellip(6,5,40,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)],'stop');
                   [h,w] = freqz(b,a);
                   OK = 1;

            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
    end
   
    if (OK==1)
        axes(handles.sumbuTapis);
        %[h,w] = freqz(b,a);
        [H,F] = freqz(b,a,N,handles.Fs);
        plot(F,20*log10(abs(H)))
        title('Tapis Yang Dirancang');

   
        xFinal = filter(b,a,handles.x2);
        handles.xFinal = xFinal;

        axes(handles.sumbuSpektrumAkhir);
        specgram(handles.xFinal, 1024, handles.Fs);
        title('Spektrum Sinyal Penapisan');
       
        % Menghitung MSE dan PSNR
        [M,N]=size(handles.xFinal);
        err = sum((handles.x-handles.xFinal).^2)/(M*M);
        MSE=sqrt(err);
        NILMAKS=65535;
        PSNR = 20*log10(NILMAKS/MSE);

        set(handles.edit6, 'String', num2str(MSE));
        set(handles.edit7, 'String', num2str(PSNR));
       
        handles.fileFinal=1;
    end
         
   
end
guidata(hObject, handles);










% --- Executes on selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (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 popupmenu4 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu4

S4 = get(hObject,'Value');

switch (S4)
    case (1)
        set(handles.textStatic7,'String','Low Freq (HZ):');
        set(handles.textStatic8,'Visible','Off');
        set(handles.editF8,'Visible','Off');
        handles.TapisTerseleksi4 = 1;
    case (2)
        set(handles.textStatic7,'String','High Freq (HZ):');
        set(handles.textStatic8,'Visible','Off');
        set(handles.editF8,'Visible','Off');
        handles.TapisTerseleksi4 = 2;      
    case (3)
        set(handles.textStatic7,'String','Low Freq (HZ):');
        set(handles.textStatic8,'Visible','On');
        set(handles.editF8,'Visible','On');
        set(handles.textStatic8,'String','High Freq (HZ):');      
        handles.TapisTerseleksi4 = 3;  
    case (4)
        set(handles.textStatic7,'String','Low Freq (HZ):');
        set(handles.textStatic8,'Visible','On');
        set(handles.editF8,'Visible','On');
        set(handles.textStatic8,'String','High Freq (HZ):');      
        handles.TapisTerseleksi4 = 4;  
end

guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (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



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


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



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


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


% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
run tabel_grafik;




No comments: