How to run .m file from delphi o visual basic

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run .m file from delphi o visual basic

cesarrodriguez.paginasamarillas.com
good morning

Ho can I do run a .m file from another aplication ? , I need just run the file

_______________________________________________________
CESAR AUGUSTO RODRIGUEZ SUAREZ



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Søren Hauberg
On Linux (or other flavors if Un*x) you do this using pipes (the exact
syntax depends on the programming language). But it sounds like you're
using windows. If you don't need the to communicate with the process
that's running Octave then (in C at least) you should be able to use the
"system" function. I guess Visual Basic and Delphi have something like
the C system function, but I don't know these languages.

/Søren

cesarrodriguez.paginasamarillas.com wrote:

> good morning
>
> Ho can I do run a .m file from another aplication ? , I need just run the file
>
> _______________________________________________________
> CESAR AUGUSTO RODRIGUEZ SUAREZ
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Przemek Klosowski
In reply to this post by cesarrodriguez.paginasamarillas.com
You don't want to run an .m file from another application. You can,
however, run Octave from another application, by doing something like
system('octave'), and telling octave to run your .m file
(e.g. system('octave myfile.m')).



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Riccardo Corradini
In reply to this post by Søren Hauberg
Hi all,
I would like to suggest a good alternative to Visual Basic
that is absolutely GNU like octave, even though is similar ..
Gambas is not a VB clone
This is the link
http://gambas.sourceforge.net/

You will find there is a shell command similar to windows API for dos windows
It could be used easily with octave

Let me know if you find useful
Best regards
Riccardo Corradini

On Monday 19 September 2005 15:15, Søren Hauberg wrote:

> On Linux (or other flavors if Un*x) you do this using pipes (the exact
> syntax depends on the programming language). But it sounds like you're
> using windows. If you don't need the to communicate with the process
> that's running Octave then (in C at least) you should be able to use
> the
> "system" function. I guess Visual Basic and Delphi have something like
> the C system function, but I don't know these languages.
>
> /Søren
>
> cesarrodriguez.paginasamarillas.com wrote:
> > good morning
> >
> > Ho can I do run a .m file from another aplication ? , I need just run
>
> the file
>
> > _______________________________________________________
> > CESAR AUGUSTO RODRIGUEZ SUAREZ
> >
> >
> >
> > -------------------------------------------------------------
> > Octave is freely available under the terms of the GNU GPL.
> >
> > Octave's home on the web:  http://www.octave.org
> > How to fund new projects:  http://www.octave.org/funding.html
> > Subscription information:  http://www.octave.org/archive.html
> > -------------------------------------------------------------
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

aleksandra
In reply to this post by cesarrodriguez.paginasamarillas.com
Hi,

Even though it's like 5 years from the last post, I am writing to ask have you found solution? I've found shell function which is ok for running applications from vb, but since I need to run .m file like once in a second it doesn't seem like the best idea to run octave from beginning every time... Do you have some suggestion?

Thanks,
Aleksandra
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Georgios Kousiouris

Hi,

In a similar situation that I had faced, when trying to run octave from
shell many times, I found it very useful and (obviously) much faster to
concentrate all the values in one file instead of calling octave for
each case. Then I passed as input to octvae the array of values and
executed the function I needed for each line separately. It  helps you
avoid the octave initialization time, which in my case was much more
time then the actual response of the function.

Hope it helps,
George



aleksandra wrote:

> Hi,
>
> Even though it's like 5 years from the last post, I am writing to ask have
> you found solution? I've found shell function which is ok for running
> applications from vb, but since I need to run .m file like once in a second
> it doesn't seem like the best idea to run octave from beginning every
> time... Do you have some suggestion?
>
> Thanks,
> Aleksandra
>  

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Siep Kroonenberg
In reply to this post by aleksandra
On Wed, Jul 21, 2010 at 09:36:17AM -0700, aleksandra wrote:
>
> Hi,
>
> Even though it's like 5 years from the last post, I am writing to ask have
> you found solution? I've found shell function which is ok for running
> applications from vb, but since I need to run .m file like once in a second
> it doesn't seem like the best idea to run octave from beginning every
> time... Do you have some suggestion?

If it is just a matter of running the .m file once a second, you can
do it within octave:

while (some condition)
  sleep(1)
  mfile
endwhile

Otherwise, many programming languages, even on windows, have some
form of `pipe open'. The parent program creates a file identifier,
but instead of opening a file for writing, it starts up a child
program and sends data to its standard input. The parent could write
instructions to the child every second.

This is also described in the Octave manual, but with Octave as
parent; search for popen.

I know this to work under Windows with Tcl as parent and Octave as
child. I have never tried anything of the kind with Delphi or VB as
parent, though.

--
Siep Kroonenberg
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

aleksandra
Hi,

Thanks for your answers.
Its not just a matter of running .m file once in a second, vb program generate some data which should be analyzed in octave and the results of analyzes should be available to vb again. The solution with pipes and child programs sounds like something that could be good solution, but I need vb to be parent and I am not sure is it possible :/
If you know anything more about that please send me some hints.

Thanks,
Aleksandra
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Siep Kroonenberg
On Thu, Jul 22, 2010 at 04:52:47AM -0700, aleksandra wrote:

>
> Hi,
>
> Thanks for your answers.
> Its not just a matter of running .m file once in a second, vb program
> generate some data which should be analyzed in octave and the results of
> analyzes should be available to vb again. The solution with pipes and child
> programs sounds like something that could be good solution, but I need vb to
> be parent and I am not sure is it possible :/
> If you know anything more about that please send me some hints.
>
> Thanks,
> Aleksandra

Googling for

vb (pipe OR popen)

I found http://support.microsoft.com/kb/871044

--
Siep Kroonenberg
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

aleksandra
This one is good, but still there's a problem, our project is written in visual basic 6, and we would like to keep it that way. Not because we are attached to vb6 but because it's a big project and if there is an option to keep it we would prefer that one.
I am pretty new in this so if you have some other idea about connecting vb6 and octave, please share it whit me. Thing we are using from octave is just some basic function fitting, so maybe there is some easier solution...
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

Siep Kroonenberg
On Thu, Jul 22, 2010 at 08:56:37AM -0700, aleksandra wrote:
>
> This one is good, but still there's a problem, our project is written in
> visual basic 6, and we would like to keep it that way. Not because we are
> attached to vb6 but because it's a big project and if there is an option to
> keep it we would prefer that one.
> I am pretty new in this so if you have some other idea about connecting vb6
> and octave, please share it whit me. Thing we are using from octave is just
> some basic function fitting, so maybe there is some easier solution...

I know very little about VB, but I doubt very much that anything
from MS from that time (1998) would support such constructs. But
maybe there are people on the list who know better...

--
Siep Kroonenberg
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

aleksandra
Another solution I was thinking about is making .exe from my octave code, but I was trying to find that solution and it seems like impossible?
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

andy buckle
On Fri, Jul 23, 2010 at 8:49 AM, aleksandra <[hidden email]> wrote:
>
> Another solution I was thinking about is making .exe from my octave code, but
> I was trying to find that solution and it seems like impossible?

Octave does not have a compiler, like Matlab does.

However, with Octave, you will find that extra licences are
exceptionally good value, so it is not the most pressing of issues.

If you make an oct file, it is possible to do stuff with #define to
make an exe. eg have a main method that is pre-processored away in
favour of a DEFUN_DLD when compiling for octave.

--
/* andy buckle */
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

aleksandra
Hi,

I've found a solution, if there is anybody else with same problem, parts of this code are really useful http://www.vbforums.com/showthread.php?t=610906#post3775602

But I need a little bit of help still. This solution for connecting visual basic and octave works fine if it is just connection of the two of them, but maybe it would be good if I use octave for plotting, so that way octave is piping gnuplot and that's not working with this code. Do any have idea why? Or is there an easy solution to improve code? If it is too demanding it is going to be enough just to have data from octave and plotting I am going to do other way.

Thanks,
Aleksandra
Reply | Threaded
Open this post in threaded view
|

Re: How to run .m file from delphi o visual basic

tmacchant
Hello

Please note that windows users are not major in this list. If you would not like to get further reply
here.  It is better to ask vb related ML or forum. As far as I know, shell function and CreateProcess
in vb do not support the redirection.  It might be reason why you cannot use gnuplot from vb. (But I
do not have any confidence.)

Another possible choice is to use the wsh.

BTW, pipe on window is slower than that of the cygwin. Octave uses pipe to commutate with gnuplot.
The graphic performance is bad because of slowness of the pipe on windows (at least windows XP. I do
have win vista nor 7 so that I do not know how is performance of pipe on the new OS. )  Therefore I
sometimes execute gnuplot script from octave using system command.

Regards

Tatsuro


--- aleksandra wrote:

>
> Hi,
>
> I've found a solution, if there is anybody else with same problem, parts of
> this code are really useful
> http://www.vbforums.com/showthread.php?t=610906#post3775602
>
> But I need a little bit of help still. This solution for connecting visual
> basic and octave works fine if it is just connection of the two of them, but
> maybe it would be good if I use octave for plotting, so that way octave is
> piping gnuplot and that's not working with this code. Do any have idea why?
> Or is there an easy solution to improve code? If it is too demanding it is
> going to be enough just to have data from octave and plotting I am going to
> do other way.
>
> Thanks,
> Aleksandra
> --
> View this message in context:
>
http://octave.1599824.n4.nabble.com/How-to-run-m-file-from-delphi-o-visual-basic-tp1601108p2316273.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave