But I found a small bug:
If I make my tick labels beforehand then use this version of the function:
format_tick(h,tickx,ticky,[],[],[],[],offset);
It re-assigns my tick labels to the default.
I did a quick-fix by copying the lines tickposx = get(h,'XTick'); and
'set(h,'XTickLabel',tickposx);' (located around line 134), and pasting them into the preceding if-statement. then I deleted the extra 'set(h,'XTickLabel',tickposx); '. However, beware! This fix may have introduced other errors that I haven't caught...