<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 589: Extract metadata from datafiles natively</title><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/" rel="alternate"/><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/feed.atom" rel="self"/><id>https://sourceforge.net/p/gnuplot/feature-requests/589/</id><updated>2025-05-15T11:01:03.932000Z</updated><subtitle>Recent changes to 589: Extract metadata from datafiles natively</subtitle><entry><title>#589 Extract metadata from datafiles natively</title><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/?limit=25#931b" rel="alternate"/><published>2025-05-15T11:01:03.932000Z</published><updated>2025-05-15T11:01:03.932000Z</updated><author><name>Daniel Dan K.</name><uri>https://sourceforge.net/u/daniel29/</uri></author><id>https://sourceforge.net83d2fa7df7fe2f4b0c6b381f067c92386f609cdc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks, Ethan, for your suggestions. 👍 Those are surely viable solutions. Clearly, I could run gnuplot using WSL and an xserver to be able to use "grep" and I've done that before. However, I was hoping for a &lt;em&gt;genuine gnuplot&lt;/em&gt; solution for all Windows users, i.e., a solution that would also work in Windows cmd.exe where "grep"  is not available and without having to compile gnuplot. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#589 Extract metadata from datafiles natively</title><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/?limit=25#222c/3271" rel="alternate"/><published>2025-05-14T16:43:30.556000Z</published><updated>2025-05-14T16:43:30.556000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net8e355b85b41a4895577e6a1b152ae94ce8c34bd2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;For a simpler case you could just invoke a shell command.  For instance if your data file will somewhere contain a line that begins with the comment character and contains the string &lt;code&gt;Measurement date = &amp;lt;some date&amp;gt;&lt;/code&gt; you could retrieve that line from inside gnuplot like this:&lt;/p&gt;
&lt;p&gt;Data file:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# example of data file containing metadata as comments
#
# Collection Date = 14 May 2025
# Location = back yard
#
1 5 6   dandelion
2 8 90  weed
3 7 55  rock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Gnuplot session:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;gnuplot&amp;gt; DATAFILE = 'foo.dat'
gnuplot&amp;gt; QUERY = "grep 'Collection Date = ' " . DATAFILE
gnuplot&amp;gt; TITLE = system(QUERY)
gnuplot&amp;gt;
gnuplot&amp;gt; unset tics; unset border
gnuplot&amp;gt;
gnuplot&amp;gt; set title TITLE
gnuplot&amp;gt; plot DATAFILE using 1:2:4 with labels notitle
gnuplot&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>#589 Extract metadata from datafiles natively</title><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/?limit=25#222c" rel="alternate"/><published>2025-05-14T16:21:31.973000Z</published><updated>2025-05-14T16:21:31.973000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net92ecd1285eac761a0a490f01f6874abc59a4332f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I suggest that you use gnuplot's plugin mechanism load a  function that retrieves the desired information by calling an external library or custom-written program that knows how to interpret JSON or whatever other custom format you like.  There is sample code and a README in the &lt;code&gt;demo/plugin&lt;/code&gt; directory of the gnuplot distribution.  The examples there are for wrapping numerical routines from an external math library and returning a numerical value, but the  same mechanism should work for wrapping a query to a text-handling library and returning a string value.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extract metadata from datafiles natively</title><link href="https://sourceforge.net/p/gnuplot/feature-requests/589/" rel="alternate"/><published>2025-05-14T08:58:39.256000Z</published><updated>2025-05-14T08:58:39.256000Z</updated><author><name>Daniel Dan K.</name><uri>https://sourceforge.net/u/daniel29/</uri></author><id>https://sourceforge.net9fc60ed1cd30525d8f37edb9aa8f55e1bf0c2dff</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I usually generate datafiles for gnuplot using an automated test station.&lt;/p&gt;
&lt;p&gt;For documentation purposes, metadata about a test run are stored inside the datafile as comments.&lt;br/&gt;
This metadata can be as simple as the time when the test started. Or it contains parameters that change from test run to test run (e.g., voltage, temperature, ...). Or any important information that pertains to a test and should be stored along with the data. This metadata can be used when creating diagrams for a test report, e.g., to give a diagram an appropriate title.&lt;/p&gt;
&lt;p&gt;Currently, gnuplot does not provide a command to specifically access metadata.&lt;/p&gt;
&lt;p&gt;Thus, I have to use a "hack" as described here: &lt;a href="https://stackoverflow.com/a/72306388/2987152" rel="nofollow"&gt;https://stackoverflow.com/a/72306388/2987152&lt;/a&gt;&lt;br/&gt;
This "hack" uses the &lt;code&gt;stats&lt;/code&gt; command to extract metadata from a datafile.&lt;/p&gt;
&lt;p&gt;I'd like to suggest a feature that allows gnuplot to extract metadata (for example JSON or simple key=value pairs) from datafiles into gnuplot variables.&lt;/p&gt;
&lt;p&gt;Please let me have your comments.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;br/&gt;
Dan&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>