~ubuntu-branches/ubuntu/trusty/scilab/trusty

« back to all changes in this revision

Viewing changes to modules/javasci/examples/others/Example7A.java

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-02 11:02:49 UTC
  • mfrom: (1.4.6)
  • Revision ID: package-import@ubuntu.com-20120802110249-0v5953emkp25geuz
Tags: 5.4.0-beta-2-1~exp1
* New upstream release
* Remove libscilab-java (remove upstream). Use libscilab2-java instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3
 
 * Copyright (C) 2006 - INRIA - Allan CORNET
4
 
 * 
5
 
 * This file is released under the 3-clause BSD license. See COPYING-BSD.
6
 
 *
7
 
 */
8
 
 
9
 
import java.io.FileOutputStream;
10
 
import java.io.ObjectOutputStream;
11
 
import javasci.SciDoubleArray;
12
 
import javasci.Scilab;
13
 
 
14
 
/**
15
 
 * @deprecated
16
 
 */
17
 
public class Example7A {
18
 
 
19
 
    public static void main(String[] args)
20
 
        {
21
 
            int col=4;
22
 
            int row=2;
23
 
            int r,c;
24
 
            double [] b=new double[row*col];
25
 
       
26
 
            SciDoubleArray a = new SciDoubleArray("A",row,col);
27
 
            Scilab.Exec("A=[1,2,3,4;5 6 7 8];");
28
 
            a.Get();
29
 
            b=a.getData();
30
 
         
31
 
            System.out.println("Example 7 A Serialize");
32
 
            System.out.println("----------------------------------------------------");
33
 
            for(r=0;r<=(a.getNumberOfRows()*a.getNumberOfCols())-1;r++)
34
 
            {
35
 
                System.out.print(""+b[r]+"  ");
36
 
            }
37
 
            System.out.println("");
38
 
            System.out.println("----------------------------------------------------");
39
 
      
40
 
            try 
41
 
            {
42
 
                FileOutputStream fichier = new FileOutputStream("Example7.ser");
43
 
                ObjectOutputStream oos = new ObjectOutputStream(fichier);
44
 
                oos.writeObject(a);
45
 
                oos.flush();
46
 
                oos.close();
47
 
            }
48
 
        
49
 
            catch (java.io.IOException e) 
50
 
            {
51
 
                e.printStackTrace();
52
 
            }
53
 
    
54
 
            Scilab.Finish();
55
 
    
56
 
        }
57
 
}