if there is not necessary to strictly use Matlab, I would recommend you to look at free-of-charge Petr Stepanek's AnClim program. The link to its official website is under this message. There, you can find also some other statistical projects connected to climatology. The AnClim program incorporates a lot of homogeneity tests including several types of the SNHT test. The program is devoted mainly to testing the annual and monthly data so it perfectly suits your needs.