Continuous numbering of figures and tables

I want the figures and tables to be numbered 1, 2, 3, ... until the end of the document instead of 1.1, 1.2, ... in chapter I, 2.1, 2.2, ... in chapter II and so on.

I know how to convert the "chapter" part of figure/table numbers from Roman to arabic:

\renewcommand \thefigure
{\ifnum \c@chapter>\z@ \@arabic\c@chapter.\fi \@arabic\c@figure}
\renewcommand \thetable
{\ifnum \c@chapter>\z@ \@arabic\c@chapter.\fi \@arabic\c@table}


One could modify the above code in order to remove the "chapter" part, but the figure/table counters would still be reset to 0 at the start of new chapters.

-

\usepackage{chngcntr}