The clearest and most intuitive article I have seen so far is
Kritzman et al., Regime Shifts: Implications for Dynamic Strategies in FAJ (May / June 2012)
It not only shows how you can use HMM for financial modelling but it also goes through the actual estimation algorithm (Baum-Welch) step-by-step and even gives full Matlab-code.
From the abstract:
Regime shifts present significant challenges for investors because
they cause performance to depart significantly from the ranges implied
by long-term averages of means and covariances. But regime shifts also
present opportunities for gain. The authors show how to apply
Markov-switching models to forecast regimes in market turbulence,
inflation, and economic growth. They found that a dynamic process
outperformed static asset allocation in backtests, especially for
investors who seek to avoid large losses.
(I am not aware of a freely accessible copy of the paper - if you find one, please include it in a comment - I will change the answer accordingly.)
As I said in the comments I am not using Matlab: For your own experiments with HMM in R you can use the depmixS4 package.
Alpha Hive uses this package to replicate large portions of Kritzman's paper(s) in a four part series and explains everything step by step - highly recommended: