The question was asked in 2014. Since that time, piecewise() was added in R2016b https://www.mathworks.com/help/symbolic/piecewise.html
Before that, you had to invoke MuPad's piecewise function using feval or evalin. I have posted the code in the past.
You have to be quite careful using Heaviside for this purpose, as Heaviside is not defined when the input expression is exactly 0. There are several different conventions for Heaviside(0), with it commonly being defined as 0, or 1, or 1/2, and sometimes even defined as infinity. MATLAB implemented sympref() to allow user control of Heaviside(0)
When you differentiate Heaviside you should get the Dirac delta distribution (which is not strictly a function.) But if you custom defined Heaviside(0) then you need to think carefully about whether dirac() is appropriate for the situation.
When you convert a piece wise description of a function to Heaviside calls, chances are that you need to toss in a dirac() for each boundary point to define the behavior right at the boundary correctly, especially for integration purposes.