Sabtu, 22 Oktober 2016

Aplikasi Perbandingan Viterbi - Sequential Data

Studi kasus  load data .xls ke table pada Matlab dan Grafik multiplot



function btnBrowse_Callback(hObject, eventdata, handles)
proyek=guidata(gcbo);
[handles.namafile,handles.direktori]=uigetfile({'*.xls;*.xlsx','file excel(*.xls,*.xlsx)';'*.*','semua file(*.*)'},'buka file xls master');
I=fullfile(handles.direktori,handles.namafile);

if ~isequal(handles.namafile, 0)
set(handles.btnReset,'Enable','on');

[A,B,C]=xlsread(I);  
header= {'1/2' 'BER' '3/4' 'BER' '7/8' 'BER'};
ba=size(C,1);
co=size(C,2);
 mydata=C(2:ba,1:co);
 rnames = zeros(1,ba)

 X1(1,1)=1;
 X2(1,1)=1;
 X3(1,1)=1;
 Y1(1,1)=1;
 Y2(1,1)=1;
 Y3(1,1)=1;
for i=1:ba-1
   rnames(1,i)=i;
   X1(i,1)=str2num(cell2mat(mydata(i,1)));
   X2(i,1)=str2num(cell2mat(mydata(i,3)));
   X3(i,1)=str2num(cell2mat(mydata(i,5)));
   Y1(i,1)=str2num(cell2mat(mydata(i,2)));
   Y2(i,1)=str2num(cell2mat(mydata(i,4)));
   Y3(i,1)=str2num(cell2mat(mydata(i,6)));

end    

set(handles.Tabel1,'data',mydata,'ColumnName',header,'RowName',rnames);
set(handles.Tabel1,'Userdata',mydata);

    mypath=(['path file :',handles.direktori,handles.namafile]);    
    [infofile]=([mypath]);
    set(handles.txtPath,'string',infofile);
      nf=handles.namafile(1,1:size(handles.namafile,2)-4);
      set(handles.txtTittle1,'string',nf);
    
      set(handles.figure1,'CurrentAxes',handles.graph1);
      x = linspace(5,10,50);
      %plot(x,aRR,'-g',x,aRR,'-b',x,aRF,':ro');
hold on
plot(X1,Y1,'-go',...
    'LineWidth',2,...
    'MarkerSize',10,...
    'MarkerEdgeColor','g',...
    'MarkerFaceColor',[0.5,0.5,0.5]);
plot(X2,Y2,':ro',...
    'LineWidth',2,...
    'MarkerSize',10,...
    'MarkerEdgeColor','r',...
    'MarkerFaceColor',[0.5,0.5,0.5]);
plot(X3,Y3,'b--o',...
    'LineWidth',2,...
    'MarkerSize',10,...
    'MarkerEdgeColor','b',...
    'MarkerFaceColor',[0.5,0.5,0.5]);

        xlabel('Period');
        ylabel('BER');
        plots=['Plot ' nf];
        title(plots);
        legend('1/2','3/4','7/8','Location','southeast');

else
    set(handles.txtPath,'string','');
    return;
end

----------------------------------------------------------------------------------------------

function btnReset_Callback(hObject, eventdata, handles)
proyek=guidata(gcbo);
mau=questdlg(['Reset ' get(proyek.figure1,'Name')''],['Anda ingin Reset  Aplikasi ini?'],'Ya','Tidak','Ya');
if strcmp(mau,'Tidak')
return;
else
    arrayfun(@cla,findall(0,'type','axes'))
    set(handles.txtPath,'String','');
    set(handles.txtPath2,'String','');
    axes(handles.graph1);cla;
    axes(handles.graph2);cla;
    
    tab1 = handles.Tabel1;
    set(tab1,'Data',[]);
    tab2 = handles.Tabel2;
    set(tab2,'Data',[]);
    hm = msgbox('Reset','Reset Sukses','help');
    set(handles.btnReset,'Enable','off');
I=imread('istn.jpg');
 set(handles.figure1,'CurrentAxes',handles.axes1);
 imshow(I);

end
---------------------------------------------------------------------------------------------






Tidak ada komentar:

Posting Komentar