Anda di halaman 1dari 5

2008/08/27

Motivation: powerful and easy!


Matlab Tutorial  Matlab: a high-performance software and a
programming language
 Powerful
 Mathematics and visualization
Based on Matlab tutorial by  Toolboxes in statistics, signal processing,
IPLab@SUT vision…
 Widely used in AI-related fields
 Easy
 Prototyping, testing, debugging, finding helps…

Motivation: the 80/20 rule Outline


 Environment
 “Remember the 80/20 rule. Hence  Matrices
80% of your code should be in some  Elementary math
high level language like Matlab… Your  Data types
time is more valuable than the  String
computer's time.”  Cell arrays
- Prof. Kevin P. Murphy  Multidimensional arrays
 Programming part next week!
 Plot, flow control, functions, debug, …

1
2008/08/27

2
2008/08/27

3
2008/08/27

Text strings Strings are character matrices


 Create a string  Strings are matrices in which elements are ASCII
numbers
 str = ‘hello world’  x = ‘hello’; x(2)
e
 disp: display any variable  x = ['ab‘ 'cd']
abcd
 x = [1 2; 3 4]; disp(x);  x = ['ab' ; 'cd']
 str = ‘hello world’; disp(str); ab
cd
 fprintf: print to stdout or files  “char” creates a padded character arrays
 fprintf(‘str=%s, one-third=%4.2f’, 1/3);  s = char('rolling','stone','momentum.')
[rolling ]
 Type “help fprintf” for file output [stone ]
[momentum]
 sprintf: string output as C  String arrays of different length: cell array (later)

4
2008/08/27

More to come next week!

 Any question?

Anda mungkin juga menyukai