Beginner question: Why does a program "forget" array assignment when returning the result?
Why does this element by element assignment not work?
Why does this element by element assignment not work?
"length" gives you the number of entries in a vector (BTW "rows" would yield the same result).
That way your loop reads

and "loops" just from 3 to 3. The only value "i" is assigned is 3.
Its the same as

So you just define element with index 3 of your vector. If you do so, by default the other entries with lower indices are set to zero, like

In this example the value of ORIGIN was not changed and is at its default value 0. So the element with index 3 is the fourth vector entry. In your sheet you obviously had set ORIGIN to 1.
So what you meant was

The loop start at 1, which is the value of ORIGIN in your sheet, and ends at length(e)=3 (which is only the index of the last vector element if ORIGIN is set to 1)
A better approach would be

because its independent from the setting of ORIGIN.
The "last" function returns the index of the last vector element, taking into account the value of ORIGIN.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.