Re: how to send a customized string to linux command in gnuplot
Ethan A Merritt <[email protected]>
| Newsgroups | gmane.comp.graphics.gnuplot.user |
|---|---|
| Message-ID | <2230376.hDDtNskxLP@stonelion> |
On Monday, 11 February 2019 11:50:12 Jon wrote:
> Hi,
>
> I need to extract a value from each file and combine a column in that
> file and then plot. The gnuplot script looks something like
>
> reset; set macro
> list="2.35 2.4 2.5 2.6 2.7 "
> do for [i in list]{
> file="/dir/to/".i."/target/file"
> cmd="head -n 6 ".@file." | tail -n 1 | awk '{printf $4}'"
> print file
> print cmd
> ef=system(@cmd)
> print ef
> plot @file u ($1-ef):2 ev ::7::301 w l ti i
> }
I do not know the reason for that exact error message,
but the code shown cannot work as written because it is not possible
to set and reevaluate macros inside a loop. See for example
https://sourceforge.net/p/gnuplot/bugs/1176/
https://sourceforge.net/p/gnuplot/mailman/message/32364975/
Fortunately as with issue #1176 there is no need to use macros at all
in your case. The solution may be as simple as removing all those @ signs.
I suggest you rewrite the code without macros and report back
if there is still an error.
Ethan
> The expected screen output is, say,
> /dir/to/2.35/target/file
> head -n 6 /dir/to/2.35/target/file | tail -n 1 | awk '{printf $4}'
> 3.243 (some intended value coming out of linux command, differing at each i)
> the intended plot with x axis shifted 3.243
>
> The execution failed complaining "invalid expression"
>
> Why is the error message? Is this possibly done with gnuplot? I am
> using gnuplot 5.2.6 on linux mint 8.1 installed in a virtualbox hosted
> with windows 7
>
> Thanks for your help!
>
> Sincerely,
> John
>
>
> _______________________________________________
> gnuplot-info mailing list
> [email protected]
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
--
entia non sunt multiplicanda praeter necessitatem
_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info