Determining whether an arbitrary access structure can be realized by an ideal linear secret sharing scheme is an important research topic. we use linear codes as the main tool to construct matrices and over a finite field for a given access structure , and show that a necessary and sufficient condition for the existence of an ideal linear secret sharing scheme realizing is that the equation has a solution. If this equation has a solution, then serves as the parity-check matrix of a linear code that realizes , and is the corresponding generator matrix. Furthermore, we prove that the result is equivalent to the following statement: there exists an ideal linear code for realizing the if and only if it is the port of a matroid that is representable over .