Javascript Shift Array Elements And Subscripts In Matlab