% this is a script file to demonstrate a few data types
Exa = 1;  % choose the example to run

switch Exa
  case 1                 % double floating point
    a = 1; b = 3+i;      % real and complex numbers
    c = [a+b, a*b, a/b]  % basic arithemtic
    d = cos(a)           % standard functions
    f = cos(c)           % watch out for complex arguments
    [realmin, realmax, eps]  % examine range
  case 2                 % integer data type
    clear          % clear all variables
    a8 = int8(12);  % demonstrate integer data type int8
    b8 = int8(18);
    sum  = a8+b8
    prod = a8*b8    % observe the result
    div  = b8/a8    % observe the result
  case 3            % characters
    clear     % clean up
    char1 = 'a';  char2 = 'b'; char3 = 'A';  % define 3 characters
    b_minus_a = char2-char1     % character arithmetic !
    a_minus_A = char1-char3
    a97 = (char1==97)
  case 4        % strings
    clear *
    name1 = 'John'  % a string in Octave and Matlab
    name2 = "Joe"   % a string in Octave only
    combined_1 = [name1,' ',name2]  % as one string
    combined_2 = [name1;name2]      % as a matrix
    combined_2(2,3)
  case 5        % Structures, entries may be of different type
    Customer1.name = 'John';
    Customer1.age = 23;
    Customer1.address = 'Empty Street';
    Customer1.ZIP = 84109
  case 6      %  cell arrays
    % "3D matrices"
    mat3 = cell(2,1);
    mat3{1} = 2*eye(3)
    mat3{2} = ones(3)
    mat3{2}-mat3{1}
end%switch
