MATLAB: Combining hours and minutes

datestr

I have a 600 x 1 double array where the hour is on the 8th row and the minutes are on the 9th row. I want to combine them into a HH:MM format. I was thinking of something like this:
out = datestr(file(8,1), file(9,1), 'HH:MM');
Which does not work obviously. Any ideas ?
Thank you

Best Answer

If you just want to combine them into a string with the HH:MM format, e.g.,
out = sprintf('%02d:%02d',file(8,1),file(9,1));