I am using pgfplotstableset and longtable to read data from a file and format it into a table composed of several subtables. I have managed to create the table and to include a caption over it. However, I would also like to include a subcaption over each one of the subtables and I have not been able to do it.
The desired output should look like:

I have created the table above with caption*. However, I would prefer to use subcaption to maintain the consistency of my references. Below, I include the minimal code, which I have used to create the table above. I have tried replacing caption* with subcaption and I get the following error:
! Package caption Error: \subcaption outside float.
Minimal code. article.tex:
\documentclass{article}
\usepackage{conf-simple}
\begin{document}
\includetable{data/minimal-data.dat}{Minimal data}{minimal-data}
\end{document}
conf-simple.sty:
\ProvidesPackage{conf-simple}
\usepackage{subcaption}
\usepackage{pgfplotstable}
\usepackage{longtable}
\usepackage{booktabs}
\pgfplotstableset{
begin table=\begin{longtable},
create on use/double/.style={create col/expr={\thisrowno{1}*2}},
end table=\end{longtable},
}
\newcommand{\includetable}[3]{
\noindent\begin{minipage}{\textwidth}
\pgfplotstabletypeset[
col sep=space,
header=false,
column type=r,
columns={0,1,double}, % display specified columns
columns/0/.style={string type, column name =},
columns/1/.style={column name=\small{Value}},
columns/double/.style={column name=\small{Double}},
% requires booktabs to place horiz rules
every head row/.style={before row={\caption{#2 \label{table:#3}} \\ \caption*{(a) First subtable} \\ \toprule
\multicolumn{3}{|c|}{Numbers} \\ \midrule}, after row=\midrule},
every last row/.style={after row=\bottomrule},
every first column/.style={column type/.add={|}{}},
every column/.style={column type/.add={}{|}},
]{#1}
\end{minipage}
\noindent\begin{minipage}{\textwidth}
\pgfplotstabletypeset[col sep=space,
header=false,
columns={0,1}, % display specified columns
columns/0/.style={string type,column name=},
columns/1/.style={column name=\small{Value}},
% requires booktabs to place horiz rules
every head row/.style={before row={\caption*{(b) Second subtable} \\ \toprule
\multicolumn{2}{|c|}{Numbers} \\ \midrule }, after row=\midrule},
every last row/.style={after row=\bottomrule},
every first column/.style={column type/.add={|}{}},
every column/.style={column type/.add={}{|}},
]{#1}
\end{minipage}
}
\end{document}
Minimal data file:
One 1
Two 2
Three 3
As far as I understand, the problem is related to longtable not accepting subcaptions but I do not know how to build my table in a different way.
I have found related questions like this and this but they do not solve my issue.
article.texhas an\end{table}but no\begin{table}(and does not have an\end{document})? Please consider cleaning up your code such that others can start playing with it. – Sep 04 '18 at 13:34