help-octave
[Top][All Lists]
Advanced

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

Re: sending messages to an already-running instance of octave


From: Pantxo
Subject: Re: sending messages to an already-running instance of octave
Date: Sun, 18 Jun 2017 10:26:58 -0700 (PDT)

Dan Hitt-2 wrote
> Thanks Doug, i could and i might, at least as a first step.  (So that my
> code would write the octave script then exec it.)
> 
> The disadvantage is that it would seem to start a new octave process for
> each run.
> 
> Thus if i generated 10 plots, i'd have 10 instances of octave.
> 
> Ideally, it would contact an already running octave, and tell it to plot,
> and also be able to check back in with octave to see if the plot is still
> being displayed, and if so, maybe add to it.  (Or, if the user modified
> the
> data through octave, it might ask to peek at the workspace, recover the
> changed data, process it, and ask it to re-plot.)
> 
> (I don't think i want to run octave as a slave process though, because
> that
> would presumably inhibit it from being controlled in other ways?)
> 
> Thanks again!
> 
> dan
> 
> 
> On Sun, Jun 18, 2017 at 10:09 AM, Doug Stewart <

> doug.dastew@

> >
> wrote:
> 
>>
>>
>> On Sun, Jun 18, 2017 at 12:58 PM, Dan Hitt <

> dan.hitt@

> > wrote:
>>
>>> Thanks Olaf!
>>>
>>> My situation is that i'm writing software that produces data i would
>>> like to plot and probably interact with, and i want it to be as smooth
>>> and easy as possible.
>>>
>>> It would be possible for me to create plots in gtk, with all the
>>> advantages of interactivity and control and so on that this implies,
>>> but also all the disadvantages of a great deal more code, most of it
>>> devoted to supporting other code.
>>>
>>> What i would like to do instead is marshal the data and write it (to a
>>> file or a socket or whatever) and send a command off that says "plot".
>>> (Possibly down the road, it would be nice to get a descriptor back and
>>> be able to produce more data, and send a command that says "add to
>>> plot".)
>>>
>>> So i'd like to separate the data preparation from the graphing, what
>>> people sometimes call separating the "business logic" from the
>>> presentation.
>>>
>>> (This of course is not new with me nor with this century, so it may
>>> just be my total ineptness at googling that i can't jump right to an
>>> api.)
>>>
>>> I'm using debian 9 ("stretch") and would like to do all of this with
>>> free software.  Software in debian packages would be best, but i don't
>>> mind compiling things.
>>>
>>> And i wouldn't have to use octave, but it would have to be something
>>> along those lines, something that plots as well as letting the user
>>> interact with the data.
>>>
>>> And the communication really has to be at arm's length, the choice of
>>> my programming language is dictated by other concerns.
>>>
>>> TIA for any more hints!
>>>
>>> dan
>>>
>>> On Sun, Jun 18, 2017 at 8:39 AM, Olaf Till <

> i7tiol@

> > wrote:
>>> > On Sat, Jun 17, 2017 at 10:21:46PM -0700, Dan Hitt wrote:
>>> >> Suppose that i start octave from the command line or otherwise, and
>>> am
>>> >> interacting with it.
>>> >>
>>> >> And suppose that i then run some other program.
>>> >>
>>> >> Is there any way that the other program can send commands and data to
>>> >> my running octave, through dbus or any other ipc method?
>>> >>
>>> >> The only requirements are that the user should not have to do
>>> anything
>>> >> to octave to make it respond (e.g., the user should not have to tell
>>> >> octave to open a particular file), and the other program and octave
>>> >> should be unrelated processes (although owned by the same user).
>>> >>
>>> >> (The kinds of commands would be things that a user could presumably
>>> >> directly do, like make plots, or inquire about the internal state of
>>> >> octave, and the data would be numerical.)
>>> >>
>>> >> TIA for any info or suggestions.
>>> >
>>> > I think this would require a thread for remote execution in Octave, or
>>> > a mode of Octave in which every command is executed by an Octave
>>> > server. This is both not implemented.
>>> >
>>> > Maybe there are ideas for alternative solutions if you detail your
>>> > needs.
>>> >
>>> > Olaf
>>> >
>>> > --
>>> > public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
>>>
>>> _______________________________________________
>>> Help-octave mailing list
>>> 

> Help-octave@

>>> https://lists.gnu.org/mailman/listinfo/help-octave
>>>
>>
>>
>>
>>
>> Take a look at this:
>>
>> https://www.gnu.org/software/octave/doc/interpreter/
>> Executable-Octave-Programs.html
>>
>>
>> this part
>>
>> Note that when Octave is started from an executable script, the built-in
>> function argv returns a cell array containing the command line arguments
>> passed to the executable Octave script, not the arguments passed to the
>> Octave interpreter on the ‘#!’ line of the script. For example, the
>> following program will reproduce the command line that was used to
>> execute
>> the script, not ‘-qf’.
>>
>> #! /bin/octave -qf
>> printf ("%s", program_name ());
>> arg_list = argv ();
>> for i = 1:nargin
>>   printf (" %s", arg_list{i});
>> endfor
>> printf ("\n");
>>
>>
>>
>>
>> you should write your data to a file, then run a script like above that
>> does what you want..
>>
>> Is this what you wanted?
>>
>>
>> --
>> DAS[image: Certificate for 206392]
>>
>> <https://linuxcounter.net/user/206392.html>
>>
> 
> _______________________________________________
> Help-octave mailing list

> Help-octave@

> https://lists.gnu.org/mailman/listinfo/help-octave

Hi,

Please write your answers at the bottom of quoted messages (bottom posting),
it is the custom on this list.

Octave can be made to execute a function periodically: see
"add_input_event_hook". With this function you can probably fake a server
client communication from a single instance of Octave.

Pantxo




--
View this message in context: 
http://octave.1599824.n4.nabble.com/sending-messages-to-an-already-running-instance-of-octave-tp4683731p4683739.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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