help-octave
[Top][All Lists]
Advanced

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

Re: Adding .m into javaoctave


From: Martin Helm
Subject: Re: Adding .m into javaoctave
Date: Wed, 22 Aug 2012 10:28:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0

Am 22.08.2012 07:03, schrieb astie darmayantie:
> it said that the image package is not installed. can i install it like
> i do in octave?
> because seems like the javaoctave can not "remember" that i have
> installed the image package, so that i had to "remind" it every time i
> recompile.
>
> and here's my code :
> import dk.ange.octave.OctaveEngine;
> import dk.ange.octave.OctaveEngineFactory;
> import dk.ange.octave.type.OctaveDouble;
>
> public class testOctave {
>    
>     public static void main(String[] args){
>         OctaveEngine octave = new OctaveEngineFactory().getScriptEngine();
>         octave.eval("i=imread('/home/astie/thesis/octave/maple.png');");
>         octave.eval("pkg install -forge image;");
>         octave.eval("res=mainProg2108(i);");
>         OctaveDouble res = octave.get(OctaveDouble.class, "res");
>         octave.close();
>         Double result = res.get(1);
>         System.out.println(result);
>        
>        
>     }
>
> }
>
> the mainProg2108 is a function i made. in this case, am i able to
> called it from javaoctave? if yes, where should i put the .m file?
> as in the actual octave i just put it on the directory of image package.
>
>
> Thank you.
>
> regards,
>
>
> astie
javaoctave just calls your normal octave installation, unless you have
two or more of them and it calls the wrong one where no image package is
installed.
You should call

octave.eval("pkg load image"); //works perfectly well for me

instead of the octave.eval("pkg install -forge image;");
If that does not work please add a 

octave.eval("pkg list")

and post the full terminal output of a run of your program.



reply via email to

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