Computational Intelligence, SS08
2 VO 442.070 + 1 RU 708.070 last updated:
General
Course Notes (Skriptum)
Online Tutorials
Introduction to Matlab
Neural Network Toolbox
OCR with ANNs
Adaptive Filters
VC dimension
Gaussian Statistics
PCA, ICA, Blind Source Separation
Hidden Markov Models
Mixtures of Gaussians
Automatic Speech Recognition
Practical Course Slides
Homework
Exams
Animated Algorithms
Interactive Tests
Key Definitions
Downloads
Literature and Links
News
mailto:webmaster


Unterabschnitte

Other Data Structures

Mulitdimendional Arrays

Multidimensional arrays in Matlab are arrays with more than two subscripts. They can be created by calling zeros, ones, rand, or randn with more than two arguments, e.g.
>> R = rand(2,3,2);
or directly by
>> R(2,4,1) = 2

R(:,:,1) =
    0.7843    0.0310    0.5586         0
    0.3879    0.5855    0.2007    2.0000

R(:,:,2) =
    0.0874    0.2594    0.0492         0
    0.9332    0.2042    0.6062         0
Indexing works straight forward
>> R(2,1,1)

ans =
    0.3879

Character and Text

Enter text into Matlab using single quotes. For example,
>> S = 'Hello World!';
It is a 1-by-12 character array. For the conversion between character and numeric array use
>> a = double(S);
and
>> S = char(a);
For the conversion from numbers to strings use
>> S2 = int2str(1024);

S2 =
1024
Further
>> S2 = char(S,S2)

S2 =
Hello World!
1024
produces a 2-by-12 character array, where blanks are added to each line to make them all the same length.

Cell Arrays

Cell arrays in Matlab are multidimensional arrays whose elements are copies of other arrays. Cell arrays are created by enclosing a miscellaneous collection of things in curly braces, {}:
>> C = {R -1 S rand(2,2)}

C =
    [2x4x2 double]    [-1]    'Hello World!'    [2x2 double]
To retrieve the contents of one of the cells, use subscripts in curly braces.
>> C{3}

ans =
Hello World!
Like numeric arrays also cell arrays can be mulitdimensional
>> CM{2,2} = S;
>> CM{1,1} = 'hallo'

CM =
    'hallo'                []
         []    'Hello World!'

Structures

Structures are multidimensional Matlab arrays with elements accessed by textual field designators. For example,
>> A.name = 'Rudi';
>> A.score = [ 2 3 4];
>> A.fancy = rand;
>> A(1)

A =
     name: 'Rudi'
    score: [2 3 4]
    fancy: 0.0664
Like everything else in Matlab, structures are arrays, so you can insert additional elements.
>> A(2) = A(1);
>> A(2).name = 'Fredi';