Adds all elements in two (one- or two-dimensional) floating point arrays.
Mat Add a() = b() + c() or
Mat Add a(), b() or
Mat Add a(), x
a(), b(), c():names of one- or two-dimensional floating point (Double) arrays
x:aexp
Mat Add a()= b() + c() is only valid for floating point arrays of the same order, such as Dim a(n, m),b(n, m),c(n, m) or Dim a(n),b(n),c(n). The contents of elements in array c() are added to the contents of elements in array b() and the result is written to array a().
Mat Add a(), b() adds the contents of elements in array b() to the elements in array a() and writes the result to array a(). The original array a() is thereby lost.
Mat Add a(), x adds the expression x to the contents of all elements in array a() and writes the result to array a(). The original array a() is thereby lost.
OpenW # 1 : FontName = "courier new"
Global Double a(1 .. 3, 1 .. 5)
Global Double b(1 .. 3, 1 .. 5)
Global Double c(1 .. 3, 1 .. 5)
Local x%
Mat Set b() = 3
Mat Set c() = 4
Mat Print b()
Print String$(9, "-")
Mat Print c()
Print String$(9, "-")
Mat Add a() = b()+c()
Mat Print a()
Erase a(), b(), c()
...or...
OpenW 1 : FontName = "courier new"
Global Double a(1 .. 3, 1 .. 5)
Global b#(1 .. 3, 1 .. 5), x%
Mat Set a() = 1
Mat Set b() = 3
Mat Print a()
Print String$(10, "-")
Mat Print b()
Print String$(10, "-")
Mat Add a(), b()
Mat Print a()
Erase a(), b()
...or...
OpenW 1 : FontName = "courier new"
Global Double a(1 .. 3, 1 .. 5)
Mat Set a() = 1
Mat Print a()
Print String$(10, "-")
Mat Add a(), 5
Mat Print a()
Erase a()
Use the format of dimensioning Dim v#(1..n, 1..m) so the indexing doesn't depend on the Option Base setting.
Mat Base is no longer supported.
{Created by Sjouke Hamstra; Last updated: 13/10/2014 by James Gaite}