Numeric:
>> A=20
A =
20
>> B=int8(20)
B =
20
>> B=int8(A)
B =
20
Character:
>> s1='h'
s1 =
h
>> whos
Name Size Bytes Class Attributes
A 1x1 8 double
B 1x1 1 int8
s1 1x1 2 char
>> uint16(s1)
ans =
104
String:
Logical Operations and Assignments:
>> str='aardvark';
>> 'a'==str
ans =
1 1 0 0 0 1 0 0
>> str(str=='a')='Z'
str =
ZZrdvZrk
Exercise:
>> s1='I like the letter E';
>> a=size(s1);
>> s2=s1(a(2):-1:1);
>> a
a =
1 19
>> s2
s2 =
E rettel eht ekil I
Structure:
next one:
Structure Functions:
fieldnames:
rmfield:
Nesting Structure:
Cell Array:
cell is seen as apointer in matlab.
Exercise:
Accessing Cell Array:
Cell Array Functions:
Multidimensional Array:
row column layer
cat():
reshape:
File Access:
Save():
>> save mydata1.mat
>> save('mydata2.mat','-ascii')
>> load('mydata1.mat')
>> load('mydata2.mat','-ascii')
Excel File Reading:
xlsread():
Excel File Writing:xlswrite()
Getting Text inExcel Speadsheet:
Low-level File Input/Output:
Low-level File Input/Output Functions:
Writing Sine Values into A File:
Read and Write through File:
Reading from Files: