Extract number from matrix

  1. Use code tags when inserting code.
  2. You forgot semicolon at end of first line.
  3. You have to set comma instead of point in between numbers "2" and "3" of first line
a=Matrix(2,3);
b=a[0][0];
printf( "type of b is: %s\n", typeof(b) );
printf( "value b is: %g", b );

732

You should read here about what Matrix function is doing.
It creates a matrix with intial value as 3rd argument of that function.
Then you have to fill the matrix with values.

(Very) basic example

a=Matrix(2,3, intial = NULL );
a[0][0] = 1;// 1st row, 1st column
a[1][0] = 2;// 2nd row, 1st column
a[0][1] = 3;// 1st row, 2nd column
a[1][1] = 4;// 2nd row, 2nd column
a[0][2] = 5;// 1st row, 3rd column
a[1][2] = 6;// 2nd row, 3rd column

printf( MxToString(a) );

b=a[0][0];

printf( "\ntype of b is: %s\n", typeof(b) );
printf( "value b is: %g", b );
3 Likes