Covert your times to strings (keeping the leading zeros), and then use datetime to convert..
T = 0830;
T = sprintf('%04d',T)
dur = datetime(T,'InputFormat','HHmm','Format','h:mm a')
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!