00001 import javasci.* ;
00002
00003 class Real3
00004 {
00005
00006 private static void DisplayResult(String name,double []mat,int r,int c)
00007 {
00008 int i=0;
00009
00010 System.out.println("row= "+r);
00011 System.out.println("col= "+c);
00012 System.out.println(name+"= ");
00013 for(i=0;i<r;i++)
00014 {
00015 System.out.print(mat[i]+" ");
00016 }
00017 System.out.println(" ");
00018 }
00019
00020
00021 public static void main(String[] args)
00022 {
00023 SciDoubleArray A = new SciDoubleArray("A",4,1, new double [] {1.1,2.2,3.3,4.4} );
00024 A.Send();
00025 SciDoubleArray B = new SciDoubleArray("B",4,1, new double [] {4.4,3.3,2.2,1.1} );
00026 B.Send();
00027 SciDoubleArray C = new SciDoubleArray("C",4,1, new double [] {1. ,1. ,1. ,1.} );
00028 C.Send();
00029 SciDoubleArray D = new SciDoubleArray("Dim",1,2);
00030 D.Send();
00031 SciDoubleArray E = new SciDoubleArray("E",C);
00032 E.Send();
00033
00034 Scilab.Exec("C=A+B;");
00035 D.Job("Dim=size(C);");
00036
00037 DisplayResult(A.getName(),A.getData(),A.getRow(),A.getCol());
00038 DisplayResult(B.getName(),B.getData(),B.getRow(),B.getCol());
00039 DisplayResult(C.getName(),C.getData(),C.getRow(),C.getCol());
00040 DisplayResult(E.getName(),E.getData(),E.getRow(),E.getCol());
00041
00042 }
00043
00044 }
00045