How can a chemical structure be stored in a matrix?
Are the use of MATLAB (or OCTAVE) and a self-designed molecular representation mandatory for you project? 

Established 2D- and 3D representations for molecules beyond a connectivity matrix, i.e. with coordinates, (partial) charges, annotation of isotopes, etc. exist, such as in the form of the Chemical Markup Language (CML).

In addition, well-documented toolkits, frameworks and modules are available to operate on these data are available for C++, Java, Perl, Python, and Ruby.