We study the Gelfand-Shilov spaces of Roumieu and Beurl-ing type in the quasianalytic and nonquasianalytic case and characterize elements of the spaces in terms of the coefficients of their Fourier-Hermite expansion. The nontriviality conditions we assume on the spaces are new and weaker than the usually considered, and therefore a lot of classical spaces appear to be just examples of the spaces we consider in the paper.