You are on page 1of 66

qwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcv bnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjkl zxcvbnmqwertyuiopasdfghj klzxcvbnmqwertyuiopasdfg MATLABTE GUI UYGULAMALARI TASARIMI(OTOMASYON PROGRAMI) hjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopa sdfghjklzxcvbnmqwertyuio pasdfghjklzxcvbnmqwertyu

iopasdfghjklzxcvbnmqwert yuiopasdfghjklzxcvbnmqwe rtyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcv bnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjkl


T.C. GAZ NVERSTES ENDSTRYEL SANATLAR ETM FAKLTES BLGSAYAR RETMENL BLM
( LSANS MEZUNYET TEZ, 2010-2011 RETM YILI) HAZIRLAYAN : 070340045-kke KOLUKISA : rt. Gr. Dr. Hakan GEDK TEZ DANIMANI ANKARA-2011
1

070340045-kke KOLUKISA

indekiler
indekiler............................................................................................................... 2 ekiller Tablosu...................................................................................................... 3 BLM-I ................................................................................................................. 6 MATLABE GR .....................................................................................................6 Temel Bilgiler ..................................................................................................... 6 Matlab Ortam ve Pencereler ..............................................................................6 Array Editor Penceresi .....................................................................................7 Command History Penceresi: ..........................................................................7 Command Window Penceresi: .........................................................................8 Current Directory Penceresi: ...........................................................................8 Demos Penceresi: ............................................................................................8 Help Penceresi: ............................................................................................... 9 Workspace Penceresi: .....................................................................................9 Aritmetik lemler ve Operatrler .....................................................................10 /Karlatrma lemleri ve Operatrleri ............................................................10 Mantksal lemler ve Operatrler ....................................................................11 Aklama Operatr ..........................................................................................11 Komutlarn Ekran ktsn Gizleme Operatr ..................................................11 Deikenler ...................................................................................................... 11 Deikenlere Deer Atama lemi ve Atama Operatr ...................................12 Rakamlar ......................................................................................................... 12 Hazr Matematiksel Fonksiyonlar ......................................................................12 Hazr Rakamlar .................................................................................................13 Vektrler (Matrisler) .........................................................................................13 Polinomlar ........................................................................................................ 14 Grafik izim Komutlar ......................................................................................15 Zamana Bal Tekrarl lem Yaptrma Komutlar .............................................16 2

070340045-kke KOLUKISA Timer Nesnesi ile Herhangi Bir Matlab Komutunun altrlmas ..................16 Timer Nesnesi ile Herhangi M Fonksiyonunun altrlmas ..........................17 Timer Nesnesinin zelliklerinin Okunmas ....................................................17 Timer Nesnesinin zelliklerinin Set Edilmesi .................................................18 Timer Nesnesinin Belirli Bir Zamanda almasnn Salanmas ...................18 Timer Nesnesinin Fonksiyonlar .....................................................................18 Timer ile izim Yaplmas iin Yaplmas Gerekenler .....................................19 Timer Nesnesinin Balatlmas ve Durdurulmas ...........................................19 Timer Nesnesinin Yok Edilmesi ......................................................................19 Fonksiyon Dosyalar (M Dosyalar, M Files) .......................................................19 BLM-II ............................................................................................................. 21 MATLABTE DI DNYADAN DATALARIN ALINMASI (IMPORT EDLMES) ...............21 Giri .................................................................................................................. 21 Datalarn Import Edilmesi .................................................................................21 Datalarn Import Edilmesi iin 1. Yntem ......................................................21 Datalarn Import Edilmesi iin 2. Yntem ......................................................23 Datalar MYSQL den ekme lemi.................................................................27 BLM-III ............................................................................................................. 34 MATLABTE YAPILAN PROGRAMIN DYAN VE ALIAN RESMLER (OTOMASYON PROGRAMI) .......................................................................................................... 34 GR................................................................................................................. 34 ifre Mens Tasarm ve kodlar...................................................................34 AnaMen Penceresinin Tasarm ve Kodlar....................................................41 renci Kayt Mens Penceresinin Tasarm Ve Kodlar................................46 KAYNAKALAR...................................................................................................... 66

ekiller Tablosu
ekil 0-1 Matlab Ana Penceresi...............................................................................6 ekil 0-2 Array Editor Penceresi.............................................................................7 3

070340045-kke KOLUKISA ekil 0-3 Demos Penceresi.....................................................................................8 ekil 0-4 Matlab Help Penceresi............................................................................9 ekil 0-5 plot (a,b) Komutu ile izilen Grafik rnei.............................................16 ekil 0-6 Matlab Editor Uygulamas Ekran Grnts...........................................19 ekil 2-7Matlab Ortamna Verilerin File Mens Yardmyla Import Edilmesi........21 ekil 2-8 Import Wizard Penceresi ile Bir Dosyadan Verilerin Import Edilmesi.....22 ekil 2-9 Workspace Alanna Import Edilen Verilerin Listelenmesi.......................23 ekil 2-10 Verilerin Import Edilecei Dosyann Workspace Alanna Srklenmesi .............................................................................................................................24 ekil 2-11 Csv Uzantl Bir Dosyadaki Verilerin Matlab Ortamna Import Edilmesi .............................................................................................................................24 ekil 2-12 Csv Dosya erisinden Import Edilecek Alanlarn (Veri Kmelerinin) Seilmesi..............................................................................................................25 ekil 2-13.............................................................................................................27 ekil 2-14.............................................................................................................27 ekil 2-15.............................................................................................................28 ekil 2-16.............................................................................................................28 ekil 2-17.............................................................................................................29 ekil 2-18.............................................................................................................30 ekil 2-19.............................................................................................................30 ekil 2-20.............................................................................................................31 ekil 2-21.............................................................................................................31 ekil 2-22.............................................................................................................32 ekil 2-23.............................................................................................................32 ekil 2-24.............................................................................................................33 ekil 3-25 ifre Mensnn Dzayn.....................................................................34 ekil 3-26 alma Anndaki Grnts................................................................40 ekil 3-27.............................................................................................................40 ekil 3-28.............................................................................................................41 4

070340045-kke KOLUKISA ekil 3-29 Ana mennn Tasarm Grnts.......................................................41 ekil 3-30 alma anndaki grnts.................................................................45 ekil 3-31.............................................................................................................46 ekil 3-32 Tasarm Grnts..............................................................................46 ekil 3-33.............................................................................................................63 ekil 3-34.............................................................................................................64 ekil 3-35.............................................................................................................65

070340045-kke KOLUKISA

BLM-I MATLABE GR
Temel Bilgiler
MATLAB kelime itibari ile MATrix LABoratory kelimelerinin ksaltlmas ile olumutur. Bu program ilk gelitirildiinde ama matris ilemlerinin kullanclar tarafndan kolaylkla yaplmasn salamaktr. Matlab, gelitirilmesi sonucu gnmzde basit matematiksel hesaplamalardan karmak analizlere varan ok eitli alanlarda kullanlabilir hale gelmitir. Bu nedenle son zamanlarda Matlab zellikle bilimsel aratrmalar iin tercih edilen ve popler olarak kullanlan bir ortam haline gelmitir. Matlab in bu denli popler oluunun altnda sunduu ok eitli komutlarn yan sra, grafiksel arabirime sahip oluu, kolay allabilir ve kullanl bir ortam etkileimi sunmas, ok eitli alanlara (rnein Kontrol Bilimi, naat Mhendislii gibi) hizmet eden farkl ve zengin ktphanesinin olmas yatmaktadr. Bu proje almasnda Matlab in 7.0.4 versiyonu kullanlmtr. Ayrca, anlatmlarda kullanclarn Windows ayarlarnn farenin sol tuunu tek ve ift tklama amal kullandklar varsaylm, yani sa elini kullananlar baz alnmtr.

Matlab Ortam ve Pencereler


Windows ortamnda Matlab yazlmn balatmak iin balat Mensnde veya Masastnde yer alan Matlab ikonunu tklamak yeterlidir. Matlab alnca karmza ekil 0.1 deki gibi bir pencere gelecektir.

ekil 0-1 Matlab Ana Penceresi

070340045-kke KOLUKISA

Alan bu pencere kendi iinde ok deiik ilevleri bulunan ve kullancnn Matlab i rahat kullanmasn salayan u pencerelerden oluur. Array Editor Command History Command Window Current Directory Demos Help Workspace

Bu pencereleri grevleri u ekildedir:

Array Editor Penceresi


Kullanc workspace penceresindeki herhangi bir deikenin zerinde ift tkladnda ekil 0,2 de grlen Array Editor penceresi ile karlar. Bu pencere yardmyla seilen herhangi bir

ekil 0-2 Array Editor Penceresi

deikenin ierii grlebilecei gibi yine ayn deikenin ierii bu pencere yardmyla deitirilebilir. Ancak, baz farkl tipteki deikenlerin ieriini deitirmek mmkn deildir. Bu durum komut kullanlarak gerekletirilebilir.
Command History Penceresi:

Bu pencere kullanlan tm komutlarn gemiini tutmak iin kullanlr. Komut ekranndan girilen her komut Matlab aldnda geerli zaman bal altndaki listeye eklenerek bu pencerede grntlenir. Kullancnn gemi komutlar grmesine ve tekrar kullanmasna imkn verir.
7

070340045-kke KOLUKISA Command Window Penceresi:

Bu pencere yardmyla kullanc Matlab komutlar girer. Girilen her komutun kts da yine bu pencerede ve komutun girilmesinin hemen ardndan grntlenir.
Current Directory Penceresi:

Matlabin herhangi bir anda aktif olarak kulland geerli dizin yolunu deitirmek, iinde bulunulan klasr ierisinde tama, kopyalama ve dosya silme gibi ilemleri gerekletirmek ve ya dosyalar hakknda bilgi edinmek iin bu pencere kullanlr. Matlab daima geerli bir yol zerinden alr. Varsaylan olarak bu yol Matlab in kurulu olduu dizin iinde yer alan Work klasrdr. Geerli klasr ierisinde yer alan kullancnn tanmlad fonksiyon dosyalar da bu alandan arlr. Eer kullanlacak fonksiyonlar farkl ise bu pencere yardmyla geerli yol tanm deitirilmelidir. Ayrca, Matlabin geerli klasr yolu ana penceredeki ara ubuunda yer alan Current Directoryu blmnden de grlebilir veya bu yol tanm deitirilebilir.
Demos Penceresi: /

ekil 0-3 Demos Penceresi

Help mensnden Demos veya Matlab ana penceresi sol alt kede yer alan Start butonu kullanlarak Demos komutunun verilmesi ile Karmza ekil 0.3 de grlen demos penceresi gelir. Kullanc bu pencere yardmyla Matlabin kendi iinde yer alan hazr uygulamalar grebilir, kodlara bakabilir veya konu ile ilgili bilgiler edinebilir.

070340045-kke KOLUKISA Help Penceresi:

Bu pencereye ulamak iin ara ubuundan soru iareti simgesi tklanabilir ya da Help mens kullanlarak Matlab Help komutu verilebilir. Kullanc ekil 0.4 deki gibi bir ekran ile karlaacaktr.
/

ekil 0-4 Matlab Help Penceresi

Matlab yardm penceresi ile kullanc sunulan ok geni ve aklayc anlatm ile herhangi bir kaynaa gerek kalmadan Matlab kullanm, Matlab komutlar ve pek ok farkl konularda bilgiler edinebilir. Ayrca, bu pencerenin sol tarafnda yer alan Index tab ile tm konu balklarn srasyla grebilir ve herhangi bir konu hakknda bilgi edinebilir. Yine benzer ekilde Search tabn kullanarak hakknda bilgi edinmek istedii bir konuyu Matlabin kendi yardm dosyalar ierisinde aratabilir.
Workspace Penceresi:

Kullancnn ilettii bir komuta ait deikenlerin veya kt parametreleri daima Workspace alanna atlr. Bylece kullanc herhangi bir anda bu pencere yardmyla mevcut deikenlerin listesini grebilir. Ayrca, kullanc bu pencereyi kullanarak ieriini grmek istedii her hangi bir deikenin zerinde ift tklayarak Array Editor pencereni aabilir.

070340045-kke KOLUKISA

Aritmetik lemler ve Operatrler


Matlab ierisinde kullanlan komutlar ile gerekletirilebilecek mantksal ilemler ve her ileme ait operatr Tablo 1.3.1 de gsterilmitir.
/ /

/
Tablo 0-1 Matlab iin Aritmetik lemler ve Operatrler

/Karlatrma lemleri ve Operatrleri


Matlab ierisinde kullanlan komutlar ile gerekletirilebilecek karlatrma ilemleri ve her ileme ait operatr Tablo 1.4.1de gsterilmitir.

/
Tablo 0-2 Matlab iin Karlatrma lemleri ve Operatrleri

zellikle mantksal operatrlerden eittir durumuna dikkat edilmelidir. Karlatrma durumlarndaki eitlik anlamnda = = operatr kullanlrken, bir deikene deer atamak iin = operatr kullanlr.
10

070340045-kke KOLUKISA

Mantksal lemler ve Operatrler


Matlab ierisinde kullanlan komutlar ile gerekletirilebilecek mantksal ilemler ve her ileme ait operatr Tablo 1.5.1de gsterilmitir.

Tablo 0-3 Matlab iin Mantksal lemler ve Operatrler

Matlab ierisinde bu koulun mantksal doru (true) olmas iin bir deikenin ieriinin 0dan farkl olmas yeterlidir. Yani bu ynyle Matlab, C diline ok benzemektedir. Benzer ekilde bir deikenin ierii 0 (sfr) ise bu takdirde bu deiken mantksal olarak yanl (false) anlamna gelecektir. Mantksal operatrlerden ksa devre zelliine sahip iki operatr C dilinde kullanlan operatrlere ok benzemektedir. Bu operatrler eer ki karlatrma srasnda hem deer atamas, hem de sonucun karlatrmaya etkisinin olduu durumlarda sonuca etkisi aka grlebilir. Bu operatrlerin deer atamas olmayan ilemler iin kullanmlar ksa devre zellikli olmayan (normal) operatrler gibi alr. Matlab te karlatrma operatrlerinin ncelii soldan saa dorudur.

Aklama Operatr
Matlab ile hazrlanacak fonksiyon dosyalarnda herhangi bir satrda aklama yapmak iin aklama yaplacak cmlenin bana % iareti koyulmaldr. rnek bir kullanm aada gsterilmitir. % Bu satr bir aklama satrdr.

Komutlarn Ekran ktsn Gizleme Operatr


Yazlan bir komutun ktsn Command Window da grmek istemiyorsak o komutun sonuna ; iareti koyulmaldr. zellikle bu operatr fonksiyon dosyalarnda arka planda yaplan ilemlerin Command Window da grntlenmesinin istenmedii durumlarda kullanlr. rnek bir kullanm aada sunulmutur. a=-3; b=17; c=a-b; Bu kullanm sonucu ekranda herhangi bir kt grlmez. Ancak, workspace alanna baklrsa girilen ve hesaplanan deikenlerin varl anlalabilir.

Deikenler
Dier bilgisayar dillerinde olduu gibi MATLAB' in deiken isimleri konusunda baz kurallar vardr. En basit deiken ismi tek bir harften (karakterden) ibarettir. Belli bal kurallar unlardr.

11

070340045-kke KOLUKISA Deiken isimleri kk/byk harf kullanmna duyarldr. Buna gre ayn anlama

gelen fakat farkl yazlan saYi, Sayi, sAyi ve SAYI kelimeleri MATLAB iin farkl deikendirler. Deikenlerde Trke karakter kullanm mmkn olmamaktadr. Deiken isimleri en ok 31 karakter ierebilir. Bir deiken isminde 31 karakterden daha fazla karakter varsa hesaba katlmaz. Deiken isimleri daima bir harf ile balamal ve bunu herhangi bir sayda harfler, rakamlar veya alt izgi _ izleyebilir. Noktalama iaretleri deiken ismi olarak kullanlamaz. nk bunlarn pek ounun MATLAB iin zel bir anlam vardr. Workspace de yer alan deikenlerin listesini Command Window da grntlemek iin who veya whos komutlarndan biri kullanlabilir.

Deikenlere Deer Atama lemi ve Atama Operatr


Herhangi bir deikene deer atamak iin = atama operatr kullanlr. rnek olarak aadaki kullanmlara baklabilir. A=5 B=4 C=A*B Yukardaki rnekte A ve B deikenlere sabit deerler atanmakta ve yine C deikenine atama operatr kullanlarak A ve B deikenlerine ait deerlerin arplarak sonucun C deikenine atlmas gerekletirilmektedir.

Rakamlar
Matlab te rakamlar yazlrken ve kullanlrken u hususlara dikkat edilmelidir. MATLAB rakamlar iin nnde art veya eksi iareti ve tercihli ondalk noktas ile birlikte allagelmi ondalk (decimal) iaretler sistemi kullanr. Ondalk ayrac iin daima nokta . karakteri kullanlmaldr. (Trke de ve Windows blgesel ayarlarnda ondalk ayrac olarak virgl , ve basamak gruplandrma ayrac olarak nokta . Sembollerinin kullanldna dikkat edilmelidir.) Bilimsel iaretler sistemi 10 tabanna gre kuvvet belirlemek iin e harfi kullanr. Tm rakamlar IEEE hareketli nokta (floating-point) standart ile belirlenmi uzun format kullanarak dhili olarak saklanr. Hareketli nokta rakamlar kabaca virglden nce 16 hanelik ondalk sayl sonlu bir kesinlie sahip olup bunun sonlu alan 10-380 ile 10+380 arasndadr. Sanal rakamlar son tak olarak i veya j harfi kullanr. Kurala uygun olarak yazlan rakamlar ile ilgili baz rnekler aada sunulmutur: 6 -15 2.6397238 1.60210e-20 6.02252e23 3e5i 0.0003 -3.14159J

Hazr Matematiksel Fonksiyonlar


Matlab ierisinde gsterilmitir. kullanlan hazr matematiksel fonksiyonlar Tablo 1.11.1te

12

070340045-kke KOLUKISA

Tablo 0-4 Matlab iin Hazr Matematiksel Fonksiyonlar

Hazr Rakamlar
Matlab ierisinde gsterilmitir. kullanlan hazr matematiksel fonksiyonlar Tablo 1.12.1te

Tablo 0-5 Matlab iin Hazr Rakamlar

Vektrler (Matrisler)
Matlab ierisinde bir deikene vektr ya da matris atamas yaplrken unlara dikkat edilmelidir: Matrisleri belirtmek zere rakamlar keli parantezler iinde yazlmaldr. Ancak,
13

070340045-kke KOLUKISA

otomatik artlar belirtilmise keli parantezleri yazmaya gerek yoktur. Matris rakamlar iin stunlar arasnda , iareti kullanlmal veya boluk space konulmaldr. Matrisin bir satrna geildiinde ; iareti kullanlmaldr. Bir matrisin ieriini grntlemek iin matrisin deiken isminin yazlmas yeterlidir. Bir matrisin transpozesini almak iin matris deiken isminin en sana ' operatr koyulmaldr. Matrislerle ilgili aritmetiksel ilemler yaplrken dikkatli olunmaldr. Eer * kullanlacaksa matrislerde arpma kural gerei ilk matrisin stn says son matrisin satr saysna eit olmaldr. Eer toplama ve karma ilemleri yaplacaksa her iki matrisin boyutu da ayn olmaldr. Matris elemanlarnn birebir arpmak veya blmek iin .* ve ./ operatrleri kullanlmaldr. Bu konuda daha detayl bilgi iin 1.3 aritmetik lemler ve operatrler konusuna baklabilir. Matrisler iin otomatik aralk tanmlama ve art iin : operatr kullanlmaldr. Kullanm ilk_deger:artis_miktari:son_deger eklindedir. Eer art miktari parametresi belirtilmeden iki parametreli biimde yazlrsa otomatik art miktar olarak Matlab tarafndan 1 deeri atanr. Linear artlar iin linspace ve logaritmaik artlar iin logspace komutlar kullanlarak matris dizileri tanmlanabilir. Birim matris oluturmak iin eye komutu, birler matrisi oluturmak iin ones komutu, sfrlar matrisi oluturmak iin zeros komutu, rastgele pozitif elemanlardan oluan matris oluturmak iin rand komutu, rastgele hem pozitif hem negatif elemanlardan oluan bir matris oluturmak iin randn komutu kullanlmaldr. Bir matrisin determinantn bulmak iin det komutu, tersini bulmak iin inv komutu, z deerlerini bulmak iin eig komutu, normunu bulmak iin norm komutu, rankn bulmak iin rank komutu kullanlmaldr. Aada matrislerle ilgili rnekler yaplmtr. A=[1 2 3 4 5] B=[1;2;3;4;5] C=[8,9,0;6,7,-1] D=A*B E=B' F=D+E G=2.*C H=0:0.1:1000 K=25:75 L=eye(3) M=rand(2,4) N=rank(M) % satr vektr (matrisi) % stun vektr (matrisi) % 2 satr ve 3 stundan oluan bir matris % arpma ilemi iin her iki matrisin uygun boyutlardadr. % matrisin transpozesi alnmakta % C matrisinin tm elemanlar 2 says ile arplmakta % 0.1 artmla 0 ile 1000 aras saylardan oluan bir dizi tanmlanmakta % 25 ile 75 arasnda varsaylan artmla 1er artan bir dizi belirlenmekte % 3 x 3 boyutlarnda bir birim matris tanmlanmakta % 2 satr ve 4 stun boyutlarnda rastgele pozitif deerlerle matris tan. % M matrisinin rank hesaplanmaktadr.

Polinomlar
Matlab ierisinde polinomlarla ilemler yaplrken u hususlara dikkat edilmelidir:

Matlab te herhangi bir polinom ile ilgili ilem yaplacaksa polinom katsaylar stun vektr eklinde dnlr. Polinom arpmalar iin conv ve polinom blmeleri iin deconv komutlar kullanlmaldr.
14

070340045-kke KOLUKISA

Bir polinomun kklerini bulmak iin roots komutu kullanlmaldr. Kkleri bilinen bir polinomu retmek iin poly komutu kullanlmaldr. Bir polinom iinde x deikeninin herhangi bir deeri iin polinomun sonucu hesaplanmak isteniyorsa polyval komutu kullanlmaldr. Aada polinomlarla ilgili rnekler yaplmtr. a=[1 4 7];b=[ 8 -5 3]; c=conv(a,b) [katsayilar,kalanlar]=deconv(c,b) d=roots(b) e=poly(d) polyval (a,5) % a ve b polinomlarnn tanmlanmas % polinom blme ileminin yaplams (a / b) % polinom blme ileminin yaplams (c / b) % bylelikle katsayilar deikeni iinde tekrar a % polinomu elde edilmekte % b polinomunun kkleri hesaplanmakta % d deikenindeki kklerden polinom % bulunmakta (b polinomu tekrar elde edilmekte) % a polinomundaki bilinmeyen deikenin 5 % deeri iin polinom sonucu bulunmakta

Grafik izim Komutlar


MATLAB' da grafik iziminde kullanlan komutlarn ksa aklamalar Tablo 1.15.1te gsterilmitir.

Tablo 0-6 Matlab te Grafik izim Komutlar

A = -100:5:100; b=a.^2; plot(a,b)


15

070340045-kke KOLUKISA

grid rnek olarak komut penceresine yukardaki komutlar yazldnda ekil 0.5 teki grafik elde edilir.

ekil 0-5 plot (a,b) Komutu ile izilen Grafik rnei

Zamana Bal Tekrarl lem Yaptrma Komutlar


Matlab iinde bir komutu belirli zaman aralklaryla otomatik olarak yapmak istenilebilir. Bu ilem iin Matlab kullanclara timer nesnesi sunmaktadr. Bu nesne oluturularak ve zelliklerini deitirmek suretiyle bir komut otomatik olarak icra edilebilir. Matlab iinde bir timer nesnesi oluturmak iin timer komutu kullanlr. Ancak, timer nesnesi ile basit bir Matlab komutu ile bir fonksiyonun icra edilmesi farkllk arz etmektedir. Bu nedenle konu iki ayr alt balk altnda aada ayrntl olarak ele alnmtr.
Timer Nesnesi ile Herhangi Bir Matlab Komutunun altrlmas

Bu ilem iin rnek olarak ekrana 5 saniye aralklarla Timer tetiklendi. Mesajn yazalm. Aada verilen komut satrlar ile konu aklanmaya allsn. T = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' , ' StartDelay ' , 5 , ' Period ' , 3 ); set ( T , 'ExecutionMode' , 'fixedrate' ); Burada StartDelay zellii 5 deeri atayarak timern almaya balatldktan 5 saniye sonra tetiklenmeye balamas salanmtr. Ayrca, bu timer 3 saniye aralklarla tetiklenecektir. ExecutionMode zellii fixedrate deerine atanarak srekli olarak timern
16

070340045-kke KOLUKISA

almas salanmtr. Artk, programc timer balatmak iin start ve durdurmak iin stop komutlarn kullanabilir. Ayrca, oluturulan bir timer nesnesi mutlaka ii bittiinde veya kullanlmayacaksa silinmesi ve programdan kaldrlmaldr. Bunun iin de delete komutu kullanlmaldr. Bu komutlarn rnek kullanmlar aada verilmitir. start ( T ) ; stop ( T ) ; delete ( T ) ;
Timer Nesnesi ile Herhangi M Fonksiyonunun altrlmas

Bu ilem iin rnek olarak ekrana 3 saniye aralklarla WebCam_Timer_Fcn isimli bir Matlab M fonksiyonunun altrlmas gerektii dnlsn. Aada verilen komut satrlar ile konu aklanmaya allsn. T = timer ('Period', 3, 'StartDelay', 0); timern T.TimerFcn = {@WebCam_TimerFcn, handles); Set ( T , 'ExecutionMode' , 'fixedrate' ); % StartDelay zellii sfr yaplarak % balangta hi gecikme olmadan % almas salanmaktadr.

Burada ncelikle timer komutu kullanlarak timer kullanlmak zere T deikenine timer snfndan bir class atanmaktadr. Daha sonra ise bu snf bir yap deikeni gibi ilem grecei iin bu class ile ilgili alt zelliklere . operatr ile eriilebilir. Dolaysyla oluturulan timer snfn tutan T deikeninin TimerFcn callback fonksiyonuna parametresine WebCam_Timer_Fcn M fonksiyonu ismi atanmaktadr. Burada atamann hcre yaps eklinde olduu iin ssl parantezler kullanlarak yapldna dikkat edilmelidir. Burada ok nemli bir durum udur ki icra edilecek fonksiyon eer lokal ise ya da timer komutu bir M fonksiyon dosyas iinde altrlmak isteniyor ve bu fonksiyon dosyas iinde yer alan fonksiyonlardan biri kullanlmak isteniyorsa bu durumda komut u ekilde kullanlmaldr: T.TimerFcn = {@WebCam_Timer_Fcn} ; Burada @ operatr lokal de ilem yaplacan gsterir. Daha sonra set komutu kullanlarak oluturtulan timern srekli almas ayarlanmaktadr. Kullanc bu admdan sonra start komutu ile oluturtulan timer nesnesini balatabilir ve stop komutunu kullanarak durdurabilir. Ayrca, oluturulan bir timer nesnesi mutlaka ii bittiinde veya kullanlmayacaksa silinmeleri ve programdan kaldrlmaldr. Bunun iin de delete komutu kullanlmaldr. start, stop ve delete komutlar iin rnek kullanm ekli aada verilmitir. start ( T ) ; stop ( T ) ; delete ( T ) ;
Timer Nesnesinin zelliklerinin Okunmas

Bir timer nesnesinin zelliklerini okumak iin get komutu kullanlmaldr. rnek kullanm iin aadaki komutlara baklabilir. zamanlayici = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' );
17

070340045-kke KOLUKISA

get ( zamanlayici); Bu komut ile oluturulan ve zamanlayici deikenine atlan timer nesnesine ait tm zellikler Matlab komut ekrannda listelenecektir.
Timer Nesnesinin zelliklerinin Set Edilmesi

Bir timer nesnesinin herhangi bir zelliini deitirmek iin set komutu kullanlr. rmek kullanm ekli aada verilmitir. zamanlayici = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' ); set ( zamanlayici , ' ExecutionMode ' , ' fixedRate ', ' BusyMode ' , ' drop ' , ' Period ' ,1); set komutu ile bir timer nesnesi iin atanabilecek tm zellikler listesi de aada sunulmutur. BusyMode: [ {drop} | queue | error ] ErrorFcn: string -or- function handle -or- cell array ExecutionMode: [{singleShot} | fixedSpacing | fixedDelay | fixedRate] Name ObjectVisibility: [ {on} | off ] Period StartDelay StartFcn: string -or- function handle -or- cell array StopFcn: string -or- function handle -or- cell array Tag TasksToExecute TimerFcn: string -or- function handle -or- cell array UserData
Timer Nesnesinin Belirli Bir Zamanda almasnn Salanmas

Timer nesnesini belirli bir zamanda altrmak iin startat komutuna ihtiya vardr. rnek kullanm ekli iin aadaki komutlara baklabilir. zamanlayici = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' ); startat ( zamanlayici , now+1/24 ); rnek kullanm ekli ile now komutu ile alnan anlk zaman bilgine gre o andaki zamandan bir saat sonrasnda timer devreye girecektir.
Timer Nesnesinin Fonksiyonlar

Timer nesnesinin farkl altrlacak fonksiyonu ya da komutu tutatn callback tr vardr. Bunlar aada listelenmitir.

TimerFcn callback fonksiyonu her admda altrlacak fonksiyon ya da komutlar iin StartFcn callback fonksiyonu timer nesnesi ilk almaya baladnda altrlacak fonksiyon ya da komutlar iin StopFcn callback fonksiyonu timer nesnesi sonlandrldnda altrlacak fonksiyon ya da komutlar iindir.
18

070340045-kke KOLUKISA Timer ile izim Yaplmas iin Yaplmas Gerekenler

Eer timer nesnesi ile bir plot benzeri izim komut kullanlacaksa Timer nesnesi iinde drawnow fonksiyonu kullanlmaldr. Bu ekilde grafik izim alan srekli olarak gncel tutulacaktr.
Timer Nesnesinin Balatlmas ve Durdurulmas

Oluturan bir timer nesnesini balatmak iin start ve durdurmak iin stop komutlar kullanlr. Aada bu komutlarn nasl kullnlaca gsterilmitir. zamanlayici = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' ); start ( zamanlayici ) ; stop ( zamanlayici ) ;
Timer Nesnesinin Yok Edilmesi

Oluturan bir timer nesnesi mutlaka eer artk altrlmayacaksa bellekten kaldrlmaldr. Bu ilem iin delete komutu kullanlmaldr. rnek kullanm ekli aada gsterilmitir. zamanlayici = timer( ' TimerFcn ', ' disp( '' Timer tetiklendi. '' ) ' ); start ( zamanlayici ) ; stop ( zamanlayici ) ; delete ( zamanlayici ) ;

Fonksiyon Dosyalar (M Dosyalar, M Files)


Kullanclar Matlab iinde kendilerine ait fonksiyonlar yazabilir ve kullanabilirler. Bir fonksiyon yazmak iin Windowsun Notepad program kullanlabilecei gibi Matlabin kendisine ait Editor uygulamas da kullanlabilir. Bu uygulamay amak iin komut satrndan edit komutu verilir. Kullanc ekil 0.6 teki gibi bir ekran ile karlaacaktr.

ekil 0-6 Matlab Editor Uygulamas Ekran Grnts

19

070340045-kke KOLUKISA

rnein kare_al isminde bir fonksiyon yazlm olsun ve bu fonksiyon kendisine parametre olarak gnderilen saylarn karesini hesaplasn. Bunun iin Editor uygulamasnda aadaki komutlar yazlr. function sonuc=kare_al(sayi) sonuc=sayi.^2; end Daha sonra bu dosya Matlab in kurulu olduu dizin altnda yer alan work klasrne kaydedilir. Dosyann kaydedilme esnasnda isminin fonksiyon ismi ile ayn olmasna dikkat edilmelidir. Yani kare_al ismi ile kaydedilir. Bylelikle work dizini altnda kare_al.m isminde bir m dosyas oluacaktr. Daha sonra komut satrndan aadaki komutlar girdiimizde hazrladmz fonksiyon kullanlarak girilen saynn karesi hesaplanacaktr. x=5; kare_al(x) veya kare_al(5)

20

070340045-kke KOLUKISA

BLM-II MATLABTE DI DNYADAN DATALARIN ALINMASI (IMPORT EDLMES)


Giri
Matlab kullanlarak ok eitli sayda formatlara sahip dosyalar ierisindeki veriler Workspacee import edilebilir (dardan yklenebilir). Bylelikle herhangi bir ortamda yer alan verilerin Matlab ile kullanlmas ve ilenebilmesine olanak salanm olunur.

Datalarn Import Edilmesi


Herhangi bir dosyann ierdii verilerin Workspacee import edilmesi iki farkl yolla olur. Bu yollar aada ayrntl olarak anlatlmtr.
Datalarn Import Edilmesi iin 1. Yntem

verilir.

Matlab komut satr ekrannda iken File mensnden Import Data komutu Bu durum ekil 2,1 de gsterilmitir.

ekil 2-7Matlab Ortamna Verilerin File Mens Yardmyla Import Edilmesi

21

070340045-kke KOLUKISA

Daha sonra ekrana gelecek Dosya A penceresinden ierisinden data import edilecek dosya seilir ve Tamam butonuna tklanr. Buradaki rnekte bir Excel dosyas ierisinden veriler import edilme istenmektedir. Bu admdan sonra kullanc ekil 2.2 deki ekran grntsne benzer bir grnt ile karlaacaktr. (Import Wizard penceresi dosyann formatna gre farkl ara yzlerde olabilir.) Gelen pencerede gzken alanlar ile sizin semi olduunuz dosya iindeki veri alanlar farkl olacaktr. Import Wizard penceresinin sol tarafndan ierisinden veri eklenmek istenilen dosyada bulunan tm alanlara ait veri kmelerinden biri seilir. Sa tarafta o alann verileri gzkecektir. Seilen veriler rnekteki gibi data kmesinden alnm olsun. Daha sonra bu pencere Finish butonu tkanlarak kapatlr.

ekil 2-8 Import Wizard Penceresi ile Bir Dosyadan Verilerin Import Edilmesi

22

070340045-kke KOLUKISA

Import Wizard penceresi kapandnda Matlab ana penceresinden Workspace alann kontrol ettiimizde tm verilerin geldii grlr. Bu durum ekil 2.3 te de gsterilmitir. Komut satrndan data deikeninin ismi yazldnda import edilen verilerin listelendii grlr.

ekil 2-9 Workspace Alanna Import Edilen Verilerin Listelenmesi

Datalarn Import Edilmesi iin 2. Yntem

Dosyalarn iindeki verileri Workspace alanna import etmenin bir dier yolu da Windows Explorer penceresinden dosyay farenin sol tuu ile tklamak ve farenin tuunu brakmadan basl hale Matlab ana penceresinde Workspace alannn zerinde iken farenin sol tuunu

23

070340045-kke KOLUKISA

ekil 2-10 Verilerin Import Edilecei Dosyann Workspace Alanna Srklenmesi

brakmaktr. Yani, dosyalar Workspace alanna srklemektir. Bu durum ekil 2.4 te gsterilmitir. rnein csv uzantl bir dosya srklenmi olsun. Karmza ekil 2.5 teki gibi bir Import Wizard penceresi gelecektir. Bu pencerede ekilde de gsterildii zerinde ierisinde verilerin yer ald data kmeleri tablar halinde listelenmitir. Daha sonra Next

ekil 2-11 Csv Uzantl Bir Dosyadaki Verilerin Matlab Ortamna Import Edilmesi

butonuna tklatlarak ekil 2.6daki ekran ile karlalr. Bu ekrann sol tarafnda yer alan

24

070340045-kke KOLUKISA

ekil 2-12 Csv Dosya erisinden Import Edilecek Alanlarn (Veri Kmelerinin) Seilmesi

listeden bir nceki ekranda gsterilen data kmelerinden hangisi import edilmesi gerekiyorsa o veri kmesi ismine listeden tik konulur. En son olarak Finish butonu tklatlarak datalarn Workspace alanna import edilmesi ilemi tamamlanm olur. Not: Import edilecek bir dosya ierisinde saysal veriler var ise ve bu veriler iin ondalk ayra virgl ise (Bu duruma rnek olarak Trke blgesel ayarlar verilebilir.) mutlak surette o dosya ierisindeki , karakterlerini . ile deitirin. nk, Matlab ondalk ayra olarak sadece . karakterini kabul etmektedir. Not: ok eitli programlama dilleri kullanlarak kontrol edilen sistemlere ait bilgilerin bir dosyaya kaydedilmesinde csv formatnn seilmesi programcnn verileri baka ortamlara aktarmasnda byk kolaylklar salar. Csv dosya format ierii itibari ile aslnda txt bir dosyadr. Ancak, uzants .csv olarak kaydedilmelidir. Dosya ierii ise aralarnda ; karakteri bulunan verilerdir. Veriler say veya karakter olabilir. rnein aada bir motorun hznn zamana gre deimesini gsteren verilerin dosya iindeki format grlmektedir. _______________________________________________________ Zaman;Motor Hz 0;7 1;14.25 2;21.41 3;28.12 4;35 5;42.85 6;49.96 7;56 8;63.47 9;70.56 10;77 _______________________________________________________
25

070340045-kke KOLUKISA

Ayrca, csv dosyalar MS Excel program kullanlarak alabilir ve ierisinde yer alan veriler listelenen hcreler eklinde ynetilebilir.

26

070340045-kke KOLUKISA

Datalar MYSQL den ekme lemi lk nce Matlab da start dmesine baslarak oradan Toolboxes Database Visual Query Builder tklanr. ekil 2,7 deki gibi:

ekil 2-13

lk nce MYSQL imizi Matlab a tantmamz gerekiyor onun iin gelen Query ekranndaki QueryDefine ODBC Source i seiyoruz sekil 2,8 deki gibi:

ekil 2-14

Sonra ODBC Veri Kaynaklar penceresi alr ekil 2,9 daki gibi:

27

070340045-kke KOLUKISA

ekil 2-15

buradan Sistem ODBCyi seiyoruz ve buraya MYSQL in ALAS(Takma adn) oluturuyoruz. Takma ad oluturmak iin Ekle butonuna tklyoruz karnza bir kurulum sihirbaz kacaktr. ekil 2,10 daki gibi:

ekil 2-16

28

070340045-kke KOLUKISA Bu ekranda hangi database i kullanyorsak onun srcsn sememiz gerekiyor. Biz SQL Server i seip son diyoruz. Ve karmza MYSQL Balantlarmz yapmamz iin baka bir sihirbaz kyor. ekil 2,11 deki gibi:

Buraya istediimiz Bir Ad yazyoruz


Burada MYSQL Sunucu ismini seiyoruz

ekil 2-17

Bazen sunucu admz grnmeyebilir bu yzden sknt ktn dnebilirsiniz eer sunucu ismi gelmiyor ve sizin bilgisayarnzda da MYSQL kurulu ise sadece nokta koyarak devam edebilirsiniz. lemlerimiz bittikten sonra ileri butonuna basyoruz. Bir sonraki pencerede hibir deiiklik yapmyoruz ve ileri diyoruz. ekil 2,12 deki gibi:

29

070340045-kke KOLUKISA

ekil 2-18

Bir sonraki pencerede ise MYSQL e Attach ettiimiz Database imizi seip ileri butonuna tklyoruz. ekil 2,13 deki gibi:

ekil 2-19

Bir sonraki pencerede hibir deiiklik yapmadan son butonuna tklayarak takma ad oluturmay bitiriyoruz. ekil 2,14 deki gibi: 30

070340045-kke KOLUKISA

ekil 2-20

ekil 2,15 te de grld gibi artk takma admz olumu bulunmaktadr. imdi Visual Query Builder kapatp tekrar ayoruz.

ekil 2-21

ekil 2,16 daki gibi: Ve karmza bizim eklediimiz takma ad kyor. Seim ekli 31

070340045-kke KOLUKISA

art alan

SQL Komut Alan Atanlacak Deiken ismi

ekil 2-22

Buradan hi uramadan SQL e balanmann kodlarn oluturabiliriz ekil 2,17 deki gibi:

ekil 2-23

32

070340045-kke KOLUKISA

ekil 2-24

33

070340045-kke KOLUKISA

BLM-III MATLABTE YAPILAN PROGRAMIN DYAN RESMLER (OTOMASYON PROGRAMI)


GR
Burada yaplan programn amac Matlab gibi programn sadece saysal ilemlerle almadn ve normal programlama dillerinden hemen hemen az kalr yannn olmadnn gstergesidir. ifre Mens Tasarm ve kodlar

VE

ALIAN

ekil 3-25 ifre Mensnn Dzayn

Buradaki ama herkesin program amasn nlemek amacyla yaplan ifre penceresidir. 2 adet edit text , 3 adet static text ve 2 butondan olumaktadr.

34

070340045-kke KOLUKISA KODLARI;


function varargout = sifre(varargin) % SIFRE M-file for sifre.fig % SIFRE, by itself, creates a new SIFRE or raises the existing % singleton*. % % H = SIFRE returns the handle to a new SIFRE or the handle to % the existing singleton*. % % SIFRE('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in SIFRE.M with the given input arguments. % % SIFRE('Property','Value',...) creates a new SIFRE or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before sifre_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to sifre_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 % Edit the above text to modify the response to help sifre % Last Modified by GUIDE v2.5 24-May-2011 06:17:51 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @sifre_OpeningFcn, ... 'gui_OutputFcn', @sifre_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 sifre is made visible. function sifre_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 sifre (see VARARGIN) % Choose default command line output for sifre handles.output = hObject;

35

070340045-kke KOLUKISA
% Update handles structure guidata(hObject, handles); % UIWAIT makes sifre wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = sifre_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;

function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (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 edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (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 edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (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 edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (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'))

36

070340045-kke KOLUKISA
set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton1.

Aadaki fonksiyonda database e kayt edilmi kullanc ad ile ifresini kontrol eden bir mekanizmadr. Ve giri butonunun callback olayna yazlm bir kontrol mekanizmasdr.
function pushbutton1_Callback(hObject, eventdata, handles) conn = database('sbs','','password'); % Read data from database. e = exec(conn,'SELECT ALL sube_id,kullanicino,adi,sifre,kul_tipi FROM sifre'); e = fetch(e); close(e) % Assign data to output variable. sif = e.Data; % Close database connection. close(conn) sayac=0; while 1==1 sayac=sayac+1; if sayac>length(sif(:,1)) h=msgbox('Kullanc Adn veya ifreyi yanl girdiniz Ltfen Tekrar Deneyin','Uyar','warn'); break; end kuladi=get(handles.edit1,'String'); sifr=get(handles.edit2,'String'); dkuladi=char(sif(sayac,3)); dsifr=char(sif(sayac,4)); if length(kuladi)<length(dkuladi) for j=1:(length(dkuladi)-length(kuladi)) if j==1 kuladi=strcat(kuladi,{' '}); elseif j==2 kuladi=strcat(kuladi,{' '}); elseif j==3 kuladi=strcat(kuladi,{' '}); elseif j==4 kuladi=strcat(kuladi,{' '}); end kuladi=char(kuladi); end elseif length(kuladi)>length(dkuladi) for j=1:length(kuladi)-length(dkuladi) if j==1 dkuladi=strcat(dkuladi,{' '}); elseif j==2 dkuladi=strcat(dkuladi,{' '}); elseif j==3 dkuladi=strcat(dkuladi,{' '}); elseif j==4 dkuladi=strcat(dkuladi,{' '}); end

37

070340045-kke KOLUKISA
dkuladi=char(dkuladi); end end if length(sifr)<length(dsifr) for j=1:length(dsifr)-length(sifr) if j==1 sifr=strcat(sifr,{' '}); elseif j==2 sifr=strcat(sifr,{' '}); elseif j==3 sifr=strcat(sifr,{' '}); elseif j==4 sifr=strcat(sifr,{' '}); end sifr=char(sifr); end elseif length(sifr)>length(dsifr) for j=1:length(sifr)-length(dsifr) if j==1 dsifr=strcat(dsifr,{' '}); elseif j==2 dsifr=strcat(dsifr,{' '}); elseif j==3 dsifr=strcat(dsifr,{' '}); elseif j==4 dsifr=strcat(dsifr,{' '}); end dsifr=char(dsifr); end end if kuladi==dkuladi if sifr == dsifr AnaMenu; delete(handles.figure1); end else continue; end end

% --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) selection = questdlg(['kmak stediinizden Emin misiniz ?'],... ['k ' get(handles.figure1,'Name') '...'],... 'Yes','No','Yes'); if strcmp(selection,'No') return; end delete(handles.figure1); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton1.

38

070340045-kke KOLUKISA
function pushbutton1_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in togglebutton1. function togglebutton1_Callback(hObject, eventdata, handles) % hObject handle to togglebutton1 (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 togglebutton1 % --- 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 = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- 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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

39

070340045-kke KOLUKISA

ekil 3-26 alma Anndaki Grnts

ekil 3-27

40

070340045-kke KOLUKISA

ekil 3-28

AnaMen Penceresinin Tasarm ve Kodlar Bu pencereden dier pencerelere kolaylkla ulap ilerimizi halletmemizi salar.

ekil 3-29 Ana mennn Tasarm Grnts

41

070340045-kke KOLUKISA KODLARI


function varargout = AnaMenu(varargin) % ANAMENU M-file for AnaMenu.fig % ANAMENU, by itself, creates a new ANAMENU or raises the existing % singleton*. % % H = ANAMENU returns the handle to a new ANAMENU or the handle to % the existing singleton*. % % ANAMENU('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in ANAMENU.M with the given input arguments. % % ANAMENU('Property','Value',...) creates a new ANAMENU or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before AnaMenu_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to AnaMenu_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 % Edit the above text to modify the response to help AnaMenu % Last Modified by GUIDE v2.5 26-May-2011 13:23:05 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @AnaMenu_OpeningFcn, ... 'gui_OutputFcn', @AnaMenu_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 AnaMenu is made visible. function AnaMenu_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 AnaMenu (see VARARGIN) % Choose default command line output for AnaMenu handles.output = hObject; % Update handles structure

42

070340045-kke KOLUKISA
guidata(hObject, handles); % UIWAIT makes AnaMenu wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = AnaMenu_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; % -------------------------------------------------------------------function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Untitled_2_Callback(hObject, eventdata, handles) % hObject handle to Untitled_2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Ogrkayit_Callback(hObject, eventdata, handles) % hObject handle to Ogrkayit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Ogrkayit; % -------------------------------------------------------------------function Pers_kayit_Callback(hObject, eventdata, handles) % hObject handle to Pers_kayit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Untitled_6_Callback(hObject, eventdata, handles) % hObject handle to Untitled_6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Fatislemi_Callback(hObject, eventdata, handles) % hObject handle to Fatislemi (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --------------------------------------------------------------------

43

070340045-kke KOLUKISA
function Odemeis_Callback(hObject, eventdata, handles) % hObject handle to Odemeis (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function kulEkle_Callback(hObject, eventdata, handles) % hObject handle to kulEkle (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Untitled_4_Callback(hObject, eventdata, handles) % hObject handle to Untitled_4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function Cikis_Callback(hObject, eventdata, handles) % hObject handle to Cikis (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) selection = questdlg(['kmak stediinizden Emin misiniz ?'],... ['k ' get(handles.figure1,'Name') '...'],... 'Yes','No','Yes'); if strcmp(selection,'No') return; end delete(handles.figure1); % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Ogrkayit; % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) selection = questdlg(['kmak stediinizden Emin misiniz ?'],... ['k ' get(handles.figure1,'Name') '...'],... 'Yes','No','Yes'); if strcmp(selection,'No') return; end delete(handles.figure1);

44

070340045-kke KOLUKISA

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

Buradaki fonksiyonlarn hepsi baka *.m dosyalarn aryor ve bylece birden fazla figure dosyalar birbirine balantl olmu oluyor. Aadaki fonksiyon bunun rneidir.
function Ogrkayit_Callback(hObject, eventdata, handles) % hObject handle to Ogrkayit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Ogrkayit;

Bu fonksiyon Ogrkayit.m adl m dosyasn armak ile grevli bir fonksiyondur.

ekil 3-30 alma anndaki grnts

45

070340045-kke KOLUKISA

ekil 3-31

renci Kayt Mens Penceresinin Tasarm Ve Kodlar Bu pencerede rencilerin bilgilerine ulalabilir. stenirse deitirilebilir, silinebilir, eklenebilir.

ekil 3-32 Tasarm Grnts

KODLARI 46

070340045-kke KOLUKISA
function varargout = OgrKayit(varargin) % OGRKAYIT M-file for OgrKayit.fig % OGRKAYIT, by itself, creates a new OGRKAYIT or raises the existing % singleton*. % % H = OGRKAYIT returns the handle to a new OGRKAYIT or the handle to % the existing singleton*. % % OGRKAYIT('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in OGRKAYIT.M with the given input arguments. % % OGRKAYIT('Property','Value',...) creates a new OGRKAYIT or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before OgrKayit_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to OgrKayit_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 % Edit the above text to modify the response to help OgrKayit % Last Modified by GUIDE v2.5 27-May-2011 01:20:13 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @OgrKayit_OpeningFcn, ... 'gui_OutputFcn', @OgrKayit_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 OgrKayit is made visible. function OgrKayit_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 OgrKayit (see VARARGIN) res='resim bulunamad.bmp'; yol='C:\Users\KWESS\Documents\MATLAB\icons\'; img=imread(fullfile(yol,res)); axes(handles.resim); image(img); axis off

47

070340045-kke KOLUKISA

% Choose default command line output for OgrKayit handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes OgrKayit wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = OgrKayit_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;

function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (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 edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (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 edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (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 edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

48

070340045-kke KOLUKISA

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

49

070340045-kke KOLUKISA
% 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

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 % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [res yol]=uigetfile('*.*','Resim A'); if res ==0 res='resim bulunamad.bmp'; yol='C:\Users\KWESS\Documents\MATLAB\icons\'; end img=imread(fullfile(yol,res)); axes(handles.resim); image(img); axis off % -------------------------------------------------------------------function activex1_Error(hObject, eventdata, handles) % hObject handle to activex1 (see GCBO) % eventdata structure with parameters passed to COM event listener % handles structure with handles and user data (see GUIDATA)

50

070340045-kke KOLUKISA

% --- Executes during object creation, after setting all properties. % --- Executes during object creation, after setting all properties. function ogr_listele_CreateFcn(hObject, eventdata, handles) % hObject handle to ogr_listele (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called conn = database('sbs','','password'); % Read data from database. e = exec(conn,'SELECT ALL sube_id,kayit_no,tcno,ogr_no,adi,soyadi,telefon,mez_okul,degerlendirme,cinsiyet,kayittar,veli_adi,veli_soyadi,v eli_tc,veli_meslek,veli_yakinlik,veli_tel,veli_adres,seri_no,baba_adi,anne_adi,dogum_yeri,dogum_tar,ili,ilcesi,k oy_mahalle,cilt_no,aile_sira_no,sira_no,res FROM ogr_kayitt'); e = fetch(e); close(e) % Assign data to output variable. ogr_kayit = e.Data; % Close database connection. close(conn) set(hObject,'Data',ogr_kayit);

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

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

51

070340045-kke KOLUKISA

% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (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 edit9_Callback(hObject, eventdata, handles) % hObject handle to edit9 (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 edit9 as text % str2double(get(hObject,'String')) returns contents of edit9 as a double % --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 edit10_Callback(hObject, eventdata, handles) % hObject handle to edit10 (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 edit10 as text % str2double(get(hObject,'String')) returns contents of edit10 as a double % --- Executes during object creation, after setting all properties. function edit10_CreateFcn(hObject, eventdata, handles) % hObject handle to edit10 (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

52

070340045-kke KOLUKISA

function edit11_Callback(hObject, eventdata, handles) % hObject handle to edit11 (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 edit11 as text % str2double(get(hObject,'String')) returns contents of edit11 as a double % --- Executes during object creation, after setting all properties. function edit11_CreateFcn(hObject, eventdata, handles) % hObject handle to edit11 (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 edit12_Callback(hObject, eventdata, handles) % hObject handle to edit12 (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 edit12 as text % str2double(get(hObject,'String')) returns contents of edit12 as a double % --- Executes during object creation, after setting all properties. function edit12_CreateFcn(hObject, eventdata, handles) % hObject handle to edit12 (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 edit13_Callback(hObject, eventdata, handles) % hObject handle to edit13 (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 edit13 as text % str2double(get(hObject,'String')) returns contents of edit13 as a double % --- Executes during object creation, after setting all properties. function edit13_CreateFcn(hObject, eventdata, handles) % hObject handle to edit13 (see GCBO)

53

070340045-kke KOLUKISA
% 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 edit16_Callback(hObject, eventdata, handles) % hObject handle to edit16 (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 edit16 as text % str2double(get(hObject,'String')) returns contents of edit16 as a double % --- Executes during object creation, after setting all properties. function edit16_CreateFcn(hObject, eventdata, handles) % hObject handle to edit16 (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 edit17_Callback(hObject, eventdata, handles) % hObject handle to edit17 (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 edit17 as text % str2double(get(hObject,'String')) returns contents of edit17 as a double % --- Executes during object creation, after setting all properties. function edit17_CreateFcn(hObject, eventdata, handles) % hObject handle to edit17 (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 popupmenu1. function popupmenu1_Callback(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB

54

070340045-kke KOLUKISA
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- 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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) conn = database('sbs','','password'); e = exec(conn,'SELECT ALL iladi FROM il'); e = fetch(e); close(e) % Assign data to output variable. dil = e.Data; % Close database connection. close(conn) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu4 t=get(handles.popupmenu2,'value'); ek=char(dil(t,1)); st=strcat('SELECT ALL ilceadi FROM ilceler WHERE iladi =''',{ek}); st=strcat(st,{char(39)}); conn = database('sbs','','password'); e = exec(conn,st); e = fetch(e); close(e) % Assign data to output variable. dilce = e.Data; % Close database connection. close(conn) set(handles.popupmenu3,'string',dilce);

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

55

070340045-kke KOLUKISA
set(hObject,'BackgroundColor','white'); end conn = database('sbs','','password'); e = exec(conn,'SELECT ALL iladi FROM il'); e = fetch(e); close(e) % Assign data to output variable. dil = e.Data; % Close database connection. close(conn) set(hObject,'String',dil); % --- 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 % --- 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

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

56

070340045-kke KOLUKISA

function edit19_Callback(hObject, eventdata, handles) % hObject handle to edit19 (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 edit19 as text % str2double(get(hObject,'String')) returns contents of edit19 as a double % --- Executes during object creation, after setting all properties. function edit19_CreateFcn(hObject, eventdata, handles) % hObject handle to edit19 (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 edit20_Callback(hObject, eventdata, handles) % hObject handle to edit20 (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 edit20 as text % str2double(get(hObject,'String')) returns contents of edit20 as a double % --- Executes during object creation, after setting all properties. function edit20_CreateFcn(hObject, eventdata, handles) % hObject handle to edit20 (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 edit21_Callback(hObject, eventdata, handles) % hObject handle to edit21 (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 edit21 as text % str2double(get(hObject,'String')) returns contents of edit21 as a double % --- Executes during object creation, after setting all properties. function edit21_CreateFcn(hObject, eventdata, handles) % hObject handle to edit21 (see GCBO)

57

070340045-kke KOLUKISA
% 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 edit22_Callback(hObject, eventdata, handles) % hObject handle to edit22 (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 edit22 as text % str2double(get(hObject,'String')) returns contents of edit22 as a double % --- Executes during object creation, after setting all properties. function edit22_CreateFcn(hObject, eventdata, handles) % hObject handle to edit22 (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 edit23_Callback(hObject, eventdata, handles) % hObject handle to edit23 (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 edit23 as text % str2double(get(hObject,'String')) returns contents of edit23 as a double % --- Executes during object creation, after setting all properties. function edit23_CreateFcn(hObject, eventdata, handles) % hObject handle to edit23 (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 edit24_Callback(hObject, eventdata, handles) % hObject handle to edit24 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB

58

070340045-kke KOLUKISA
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit24 as text % str2double(get(hObject,'String')) returns contents of edit24 as a double % --- Executes during object creation, after setting all properties. function edit24_CreateFcn(hObject, eventdata, handles) % hObject handle to edit24 (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 pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) res='resim bulunamad.bmp'; yol='C:\Users\KWESS\Documents\MATLAB\icons\'; img=imread(fullfile(yol,res)); axes(handles.resim); image(img); axis off set(handles.edit2,'String',''); set(handles.edit3,'String',''); set(handles.edit4,'String',''); set(handles.edit5,'String',''); set(handles.edit1,'String',''); set(handles.edit7,'String',''); set(handles.edit8,'String',''); set(handles.edit9,'String',''); set(handles.edit10,'String',''); set(handles.edit11,'String',''); set(handles.edit12,'String',''); set(handles.edit13,'String',''); set(handles.edit16,'String',''); set(handles.edit17,'String',''); set(handles.edit18,'String',''); set(handles.edit19,'String',''); set(handles.edit20,'String',''); set(handles.edit21,'String',''); set(handles.edit22,'String',''); set(handles.edit23,'String',''); set(handles.edit24,'String','');

% --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) conn = database('sbs','','password'); ek='insert into ogr_kayitt (adi,soyadi,telefon,mez_okul,degerlendirme,seri_no,baba_adi,dogum_yeri,koy_mahalle,aile_sira_no,tcno,anne_

59

070340045-kke KOLUKISA
adi,dogum_tar,cilt_no,sira_no,veli_adi,veli_soyadi,veli_tc,veli_meslek,veli_yakinlik,veli_tel,veli_adres,res,kayit tar,kayit_no,ili,ilcesi)'; ek=strcat(ek,{'Values('}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit2,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit1,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit3,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit4,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{get(handles.edit5,'String')}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit16,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit17,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.popupmenu4,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit18,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit19,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit20,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit21,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit22,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit23,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit24,'String')}); ek=strcat(ek,{char(39)});

60

070340045-kke KOLUKISA
ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit8,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit7,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit9,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit10,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit11,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit12,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.edit13,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.popupmenu2,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{','}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{get(handles.popupmenu3,'String')}); ek=strcat(ek,{char(39)}); ek=strcat(ek,{')'}); e = exec(conn,ek); e = fetch(e); close(e) % Assign data to output variable. % Close database connection. close(conn) % --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB

61

070340045-kke KOLUKISA
% handles structure with handles and user data (see GUIDATA)

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

% --- 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 conn = database('sbs','','password'); e = exec(conn,'SELECT ALL iladi FROM il'); e = fetch(e); close(e) % Assign data to output variable. datail = e.Data; % Close database connection. close(conn) set(hObject,'String',datail);

% --- Executes when selected cell(s) is changed in ogr_listele. function ogr_listele_CellSelectionCallback(hObject, eventdata, handles) % -------------------------------------------------------------------function ogr_listele_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to ogr_listele (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on key press with focus on ogr_listele and none of its controls. function ogr_listele_KeyPressFcn(hObject, eventdata, handles) % hObject handle to ogr_listele (see GCBO) % eventdata structure with the following fields (see UITABLE) % 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)

62

070340045-kke KOLUKISA

ekil 3-33

63

070340045-kke KOLUKISA

ekil 3-34

64

070340045-kke KOLUKISA

ekil 3-35

65

070340045-kke KOLUKISA

KAYNAKALAR
1) www.gencbilim.com 2) http://www.mathworks.com/support/solutions/en/data/1-19WNG/?solution=1-19WNG 3) http://www.youtube.com/watch?v=pN_68no9gOo 4) http://www.mathkb.com/Uwe/Forums.aspx/matlab/201105/1 5) http://groups.google.com/group/comp.softsys.matlab/browse_thread/thread/1cb4abad409188b6/0be89f4615595092 6) Matlab e Giri A. Karamancolu, A. Gn, Austos 2002. 7) http://www.elektrotekno.com 8) Matlab Uygulamalar Kenan SAVA 2002.

66

You might also like