Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

6SESSION 2

Data types in MATLAB

Numeric classes

Logical class

Strings and characters

A=1 double

A=´1` char- "r" / "5" / "?" String

Data types
A defined kind of data

Determines possible values (e.g. natural numbers)

Includes certain operators (+- * / …)

Defines how data is stored

Primitive data type

A language’s own data types

Custom data types (we can ignore those for now)

Which (primitive) data types are there?

Numeric

Character

Logical (Boolean)

Matrix

Sparse (matrix)

Cell

Structure

628i binary code olaraq yazmaq

123/2 = 61 Rest 1
61/2 = 30 Rest 1
30/2 = 15 Rest 0
15/2 = 7 Rest 1
7/2 = 3 Rest 1
3/2 = 1 Rest 1
1/2 = 0 Rest 1
1 bit = 1 piece of information

Binary: zero or one

1 byte = 8 bits

1 kilobyte = 1000 byte

1 megabyte = 1000 kilobyte = 1 000 000 byte

Yuxaridaki 1 byte infodu

8 bit Integer (Matlab: ‘Int8’; Java: ‘byte’)

1st position for sign (+/-) –> signed Integer

“1” as a sign means “-”

Range: -27 to 27-1 (-128 to 127)

‒ 8 bit Integer (Matlab: “Int8”; Java: “byte”)

‒ 1st position for sign (+/-) –> signed Integer

‒ Range: -27 to 27-1 (-128 to 127)

‒ 32 bit integer (Matlab: “Int32”; Java “Int”)

‒ Range -231 to 231 -1 (-2,147,483,648 to 2,147,483,647)

‒ default integer in many languages

‒ 64 bit integer (Matlab: “Int64”)

Range -263 to 263 -1 (-1019 to +1019)

1 (= true) or 0 (= false)

Shortcuts like ctrl + c to copy work in Matlab (Windows)

F5 -> run a script

F9 -> run a marked part of code

ctrl + enter -> run a segment

ctrl + c -> abort function/output

crtl + r -> comment out parts of code

ctrl + t -> Uncomment

ctr + i -> Add Auto Intendation

youtube
Clc; clear; clear all;

Mes x=5 yazandan sonra ; qoysaq v=x+y deyende xin bes oldugu command windowda gorunmeyecek
Faiz isaresi yazib sonra o sey haqqinda comment bildirmek olur xatirlatici kimi 2 faiz qoysan qara
xettle olacaq deye lap ayrilacaq

Mes xe 4 value vermisen onda en sonda en asagida yazilan value most important

Kvadrat moterize birden cox value vermek ucundu iceride reqemler arasina vergul ya bosluq

For da ist etmek olar for t=1:9

T=1:1:9 bir bir artan 9a kimi reqemler ortada 4 olsa 4 4 artacaq

Matrix yaradiriq zz=[1 2 3;4 5 6;7 8 9]

Matrixi bele yaradib sonra setir sutunu bele yoxlamaq olar eger (1, :) yazsam elece 1ci setiri gosterecek

Length z nin icindeki reqemlerin sayini gosterir

Plot dedi qarsina bu cixdi x 0dan baslayir 0.5 artir 10a kimi gedir x y beraberdiler qrafiki

Sag duymeye basib create new data type yazaraq bunu itirmeden yeni noqte gostermek olur … grid on yazib
kvadratli elemek olar
Axisde xin istediyimiz yerinden istediyimiz yerine gosterir ve ad qoymusuq

You might also like