|
From: | Lars Johansson |
Subject: | Re: Calling an octave function from a BAT file in windows |
Date: | Thu, 15 Dec 2016 12:59:05 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
Hi Kire,
Thanks for the hints. This is now my current working solution to handle a very general argument list (arguments separated by spaces). My solution is not beautiful, but for me reasonable ;-). More ideas anyone?? /Lars ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ From command line or script file (example): myapp -flag1 data1 -flag2 optionA inputfile outputfile The solution --------------------------------------- A BAT file 'myapp.bat' to pass arguments to octave via a temporary file. @echo off echo %* > argin.txt octave-cli -q --eval myapp del argin.txt --------------------------------------- An Octave wrapper script 'myapp.m' to read the list of arguments and send it as a 'varargin' list to 'myfunction' fid=fopen('argin.txt','r'); line = fgetl(fid); fclose(fid); argin=strread(line,'%s'); [a,b]=myfunction(argin) ----------------------------------------- My function 'myfunction' in 'myfunction.m' function [out1,out2]=myfunction(varargin); out1='foo'; out2='bar'; % process varargin for whatever purpose On 12/14/2016 6:35 PM, Kire Pudsje wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |