This paper addresses the problem of robust identification of a class of discrete-time linear hybrid systems, switched linear models, in a set membership framework. Given a finite collection of noisy input/output data the objective is twofold: (i) establish whether this data was generated by a system that switches amongst an a-priori known number of subsystems, and (ii) in that case identify a suitable set of linear models along with a switching sequence that can explain the available experimental information. Our main result shows that these problems are equivalent to minimizing the rank of a matrix whose entries are affine in the optimization variables, subject to a convex constraint imposing that these variables are the moments of an (unknown) Borel measure with finite support. The use of well known (tight) convex relaxations of rank allows for further reducing the problem to a semidefinite optimization that can be efficiently solved. In the second part of the paper we extend these results to handle sensor failures that result in corrupted input/output measurements. Assuming that these failures are infrequent, we show that the problem can be recast into an optimization form where the objective is to simultaneously minimize the rank of a matrix and the number of nonzero rows of a second one. In both cases, appealing to well known convex relaxations of rank and sparsity leads to overall semidefinite optimization problems that can be efficiently solved. These results are illustrated with multiple examples showing substantially improved identification performance in the presence of noise and sensor faults.