help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java and Octave


From: Alexander Barth
Subject: Re: Java and Octave
Date: Wed, 20 Mar 2013 15:54:36 +0100

Dear Jaya,

What about this code below?
Cheers,
Alex



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class octave {
    public static void main(String[] args) {

        Runtime r = Runtime.getRuntime();

        try {
            String name = "toto.png"; // input filename
            // output_name = testimagefun(input_name)
            String[] cmd = {"octave","--eval","output_name = testimagefun('" + name + "')"};
            Process p = r.exec(cmd);
            p.waitFor();

            BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = "";
           
            while ((line = b.readLine()) != null) {               
                //System.out.println(line);
                if (line.startsWith("output_name")) {
                    System.out.println("result is in " + line.split("=")[1]);
                    }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}


On Wed, Mar 20, 2013 at 1:54 PM, Jaya <address@hidden> wrote:
is there any documentation for javaoctave. 
i searched, may be my search is inefficient.

Java UI
selects an image and stores the canonicalPath as string input_filename
button click prompts to load octave and intiates the octave processing
octave writes the output into another image
octave return the output_filename as string
java displays the output_filename.

this is the requirement.
how do i acheive this using javaoctave.


_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]