MATLAB: Count up instead of down

gui

Hello All! I have this snippet ofcode:
r=get(mp.currentMedia,'duration');
remaint=r-currpos1;
set(handles.edit2,'String',remaint);
Basically, it gets the "duration" of the currently selected video in a GUIDE GUI in seconds, then -1 it by 1 and sends the value to an edittext.
Problem is it counts down 40, 39, 38… instead of up. I'm trying to figure out a way to modify this code so it counts from 0 to "duration"
Thanks!

Best Answer

If remaint counts as 40, 39, 38... then simply currpos1 will count 0, 1, 2...