I have a mathematical data where it would be very convenient to have the index to start from zero like
a=sparse([],[],[],30,1);
>> a(0)=someValueHere
Subscript indices must either be real positive integers or logicals.
but Matlab by default offers only the index to start from 1. Is there some easy hack or trick by which I could still assign a(0)
so that I don't need to create a dummyVar a0
for the value or append the value at the end?
So how to get assignment such as a(0)
in Matlab? Every time zero-index called catch the error and return someValueHere instead of the warning?