Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #1423
| Received | by 10.224.189.16 with SMTP id dc16mr2847703qab.0.1350853195887; Sun, 21 Oct 2012 13:59:55 -0700 (PDT) |
|---|---|
| Received | by 10.52.97.101 with SMTP id dz5mr1034472vdb.2.1350853195831; Sun, 21 Oct 2012 13:59:55 -0700 (PDT) |
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!x14no3540842qar.0!news-out.google.com!r17ni43198841qap.0!nntp.google.com!x14no3540837qar.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.graphics.apps.gnuplot |
| Date | Sun, 21 Oct 2012 13:59:55 -0700 (PDT) |
| In-Reply-To | <0665cef1-fa95-4d16-aa5f-8030d8674cb7@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=132.170.112.134; posting-account=PuLrswoAAADOCumTdENk-35uZLyKLL68 |
| NNTP-Posting-Host | 132.170.112.134 |
| References | <0665cef1-fa95-4d16-aa5f-8030d8674cb7@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <d4827748-d3e5-48d3-9acd-20a84f965159@googlegroups.com> (permalink) |
| Subject | Re: accesssing shell array variable with a gnuplot loop index |
| From | fh.faraz.hussain@gmail.com |
| Injection-Date | Sun, 21 Oct 2012 20:59:55 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 2807 |
| Xref | csiph.com comp.graphics.apps.gnuplot:1423 |
Show key headers only | View raw
Hello,
I got this to work by using "${var[*]}":
http://unix.stackexchange.com/questions/52453/gnuplot-shell-variable-substitution-and-arrays
Best
Faraz
On Saturday, October 20, 2012 10:22:33 PM UTC-4, fh.faraz...@gmail.com wrote:
> Hello all,
>
>
>
> I need to use shell variables in my gnuplot commands, for which I'm using the here document style. I also need to use loops inside the gnuplot code. Both these things are working.
>
>
>
> Now -- I want to use a gnuplot for loop's index to access a shell array variable. This is where I've been stuck all day.
>
>
>
> I have something like this:
>
>
>
> for ((i=0; i<=10; i++))
>
> do
>
> var[$i] = i*10
>
> done
>
>
>
> gnuplot<<EOF
>
> do for [j=1:10]{
>
> #need to access ${var[j]} somehow
>
> val=sprintf("${var[%d]", j) ##doesn't work
>
> }
>
> EOF
>
>
>
> (Individual access like ${var[1]} works.)
>
>
>
> I thought of first storing the *name* of the shell variable somewhere and then dereferencing it (using $), but didn't work.
>
>
>
> I suspect this may need using backquotes and/or expr, but am not sure. The manual mentions the 'value' command which seems to be what would be required here, but I couldn't get it to work. The 'evaluate' command also looks relevant. I have been reading the bash and gnuplot manuals -- have learned a lot the past few hours, but couldn't solve the problem.
>
>
>
>
>
> Best
>
> Faraz
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Find similar
accesssing shell array variable with a gnuplot loop index fh.faraz.hussain@gmail.com - 2012-10-20 19:22 -0700 Re: accesssing shell array variable with a gnuplot loop index fh.faraz.hussain@gmail.com - 2012-10-21 13:59 -0700
csiph-web