The SystemBuild summer block is an element-by-element summer.

To add two matricies, set the number of branches to 2 (the default) and set the number of outputs to match the number of matrix elements.

To make it easier to connect matricies between SystemBuild blocks, You should set the block InputPins and OutputPins modes to vector and set inputnames and outputlabels as vectors labels.

Here is an SBA script example you can cut and paste into the Xmath command line which adds two constant blocks (matrix) using a summer.

build

createsuperblock "matrixsum",{outputs=12}

createblock "constant",{constantvalue=3*ones(3,4),constantname="mat1",id=1,outputlabel="mat1[3x4]",outputpins="Vector",location=[100,0],icontype="Alternate",showoutputlabels="on"}

createblock "constant",{constantvalue=4*ones(3,4),constantname="mat2",id=2,outputlabel="mat2[3x4]",outputpins="Vector",location=[100,-100],icontype="Alternate",showoutputlabels="on"}

createblock "summer",{signs=[1,1],outputs=12,id=3,outputlabel="sumout[3x4]",inputname="mat1[3x4]",inputname13="mat2[3x4]",inputpins="vector",outputpins="vector",location=[250,-50]}

modifyblock 3,{icontype="Alternate",color=1,showoutputlabels="on"}

createconnection 1,3

createconnection 2,3

createconnection 3,0

t=[0,1]';

[,y] = sim("matrixsum",t)

Reading Matlab data into Xmath is tricky because the Matlab save format is closed and changing.

If you can write out you Matlab data in ASCII format and remove and headers or labels and are

just left with just numbers seperated by spaces. You could use the Xmath read command

to load it into Xmath as a matrix.

**A = read("$XMATH/demos/read_ex.ascii",10,10,"ascii")? **

Check out Xmath Math User Guide page C-16 Loading In External Data (read)