5 ms·
Maybe I've been drinking to koolaide for too long (and it's not a good flavor), but the 1-based indices in MATLAB are not bad once you get used to them. They're
by tnecniv 10y ago
Maybe I've been drinking to koolaide for too long (and it's not a good flavor), but the 1-based indices in MATLAB are not bad once you get used to them. They're especially nice when translating mathematical papers that normally index from 1.
- goatlover 10y agoYeah, I don't get the love for 0 base, unless you're doing C level stuff, which is the real reason for 0 based indexing.
- avian 10y agoI guess it depends on the field you're working with. I'm definitely more at home with 0-based languages, although at this point I have worked a lot with MATLAB/Octave code as well. In my case, it is very common that i-th element in an array is somehow related to say (x0 + i*dx). This fits naturally with 0-based indices. With 1-based indices you tend to have (i-1) or (x0-dx) everywhere. It gets extremely annoying when people get clever and rearrange this -1 in equations. Then it is no longer clear what is there as a side effect of the indexing and what is perhaps some constant in the numerical method.