Thursday 8 December 2011

Matlab data types | Matlab Datatype examples | Matlab Cell, Structure example

In Matlab data types are following
  1. Matrix/Vector
  2. Cell
  3. Structure
Matrix:

Matrix contain row and columns values .if one row/columns means that is vector.This vector also matrix.if you assign string values in one variable means that string variable also one matrix.for example
>> a = 'Matlab';
>> a(1)

ans =

M

>> a(2)

ans =

a

Cell

cell is one of the datatype in matlab.cell is also an array .This cell array stores vector/matrix in one cell.for example you have different size of matrix values means you have store a two matrix in one cell array variables.
>> a = [11 2 32 45 43543];
>> b = [23 34 34 34 34 4 34 34 34 34 341 32434];
>> my_cell{1} = a;
>> my_cell{2} = b;
>> my_cell

my_cell =

[1x5 double] [1x12 double]
Structure

Structure is one of the datatype in matlab .This structure like C,C++ structure concept.Structure store different type of values.it stores matrix,vector,string and cell array.Structure like a class also.for example
make a image structure as given below
>> my_image.name = 'matlab.jpg';
>> my_image.row = 100;
>> my_image.columns = 100;
>> my_image

my_image =

name: 'matlab.jpg'
row: 100
columns: 100

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...