To put it simply, I just want to add subcaptions to the subfigures showed in the accepted answer of this question:
Forcing subfigures to have same height and take overall X% of linewidth in LaTeX
This is how I've tried to do it:
\documentclass[a4paper,10pt]{book}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\resizebox{.9\textwidth}{!}{
\includegraphics[height=3cm]{example-image-a}
% \subcaption{Example image A.}
\quad
\includegraphics[height=3cm]{example-image-16x9}
% \subcaption{Example image 16x9.}
}
\caption{Example images.}
\end{figure}
\end{document}
When I uncomment the subcaption lines, I get the following error:
You can't use `\hrule' here except with leaders. \caption@hrule ->\hrule \@height \z@ l.13 }
Edit:
Incidentally, one of the answers (not the accepted one) to Forcing subfigures to have same height and take overall X% of linewidth in LaTeX solves my problem. From the beginning, I cited that question in this question text and said what I want in addition to its accepted answer.

\begin{subfigure}{<desired width>} ... \caption{...}\end{subfigure}work for you. – Zarko Jan 25 '16 at 17:48includegraphicsoptions, i. e :|[width = .., height= ...]? At least, what you had to do is wrapincludegraphicand belongingsubcaptioninto minipage with prescribed width. and don't useresizebox. – Zarko Jan 25 '16 at 18:24widthandheightbecause by doing so I would either change images' proportions or have to calculate the right widths myself. Also, I want a general method that will work for any pair of figures in any proportions. Let the widths bew_A,w_Band the heights beh_A,h_B. I want to define an overall widthW, then thew'sandh'smust be calculated so thath_A = h_Bandw_A + w_B = W. – Leonardo Castro Jan 25 '16 at 18:44h_A = h_B,w_A + w_B = W,h_A = p_A * w_A,h_B = p_B * w_B, where the equation parameters areW(text width),p_A(height/width proportion of the original figure A) andp_B(h/w proportion of the original figure B). – Leonardo Castro Jan 25 '16 at 18:52