Changing how the NDtvar and NPtvar are indexed so that they get the right values out of these matrices