Speed is not critical here. I am porting this script http://gmt.soest.hawaii.edu/projects/gmt-matlab-octave-api/repository/changes/trunk/src/gmtest.m
that will call the test scripts that live, as for example, here http://gmt.soest.hawaii.edu/projects/gmt/repository/show/branches/5.2.0/doc/scripts/ml and compare the produced output with the reference PS file that is also in the testing dirs. If it works, as I hope and will test later. It's good enough for me but off course faster alternatives are always wellcome. Thanks quinta-feira, 22 de Outubro de 2015 às 18:16:05 UTC+1, Stefan Karpinski escreveu: > > This will not be fast. It's also wildly insecure if the string come from > an external source. I'd strongly recommend figuring out a different > approach to what you're doing, but it's hard to provide guidance without > more context. > > On Thu, Oct 22, 2015 at 12:34 PM, Alex Ames <alexande...@gmail.com > <javascript:>> wrote: > >> You could define your own feval: >> >> feval(fn_str, args...) = eval(parse(fn_str))(args...) >> >> This has the advantage of accepting anonymous functions and multiple >> arguments if necessary: >> julia> feval("sin",5.0) >> -0.9589242746631385 >> >> julia> fn_str = "a_plus_b(a,b) = a + b" >> "a_plus_b(a,b) = a + b" >> >> julia> feval(fn_str,2,3) >> 5 >> >> On Thursday, October 22, 2015 at 8:20:33 AM UTC-5, J Luis wrote: >>> >>> Thanks, at least it's a place to start. >>> >>> quinta-feira, 22 de Outubro de 2015 às 14:10:44 UTC+1, Kristoffer >>> Carlsson escreveu: >>>> >>>> Maybe >>>> >>>> julia> eval(Symbol("sin"))(5.0) >>>> -0.9589242746631385 >>>> >>>> Not sure if this is the best solution. >>>> >>>> >>>> On Thursday, October 22, 2015 at 2:57:31 PM UTC+2, J Luis wrote: >>>>> >>>>> Hi, >>>>> >>>>> I need to convert this piece of Matlab code >>>>> >>>>> [ps, orig_path] = feval(str2func(test), out_path); >>>>> >>>>> where 'test' is the name of a function and 'out_path' it unique input >>>>> argument. I have read and re-read the eval function and for once it's >>>>> clear >>>>> for me how it works (sorry, I find this sentence highly cryptic "Evaluate >>>>> an expression in the given module and return the result" ) but worst, I >>>>> don't see anywhere how it could call a function with input arguments. >>>>> >>>>> How can I achieve the same result in Julia? >>>>> >>>>> Thanks. >>>>> >>>> >