We relate the notion of matroid pathwidth to the minimum trellis state-complexity (which we term trellis-width) of a linear code, and to the pathwidth of a graph. By reducing from the problem of computing the pathwidth of a graph, we show that the problem of determining the pathwidth of a representable matroid is NP-hard. Consequently, the problem of computing the trellis-width of a linear code is also NP-hard. For a finite field F, we also consider the class of F-representable matroids of pathwidth at most w, and correspondingly, the family of linear codes over F with trellis-width at most w. These are easily seen to be minor-closed. Since these matroids (and codes) have branchwidth at most w, a result of Geelen and Whittle shows that such matroids (and the corresponding codes) are characterized by finitely many excluded minors. We provide the complete list of excluded minors for w = 1, and give a partial list for w = 2. Key words. Matroids, pathwidth, linear codes, trellis complex...