Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi
Default start of counting of rows is 0 if not defined as anything else by ORIGIN value.
Defined rows 3 to 5. 0 to 2 rows will have zero. Check by M[0=.
so 6 rows in M.
Cheers
Terry
Hi
Default start of counting of rows is 0 if not defined as anything else by ORIGIN value.
Defined rows 3 to 5. 0 to 2 rows will have zero. Check by M[0=.
so 6 rows in M.
Cheers
Terry
How do I get 3 ?
Thats easy - you get 3 if you use a vector or matrix with just three rows. 😉
But the vector M you created has six elements for reason which Terry already explained.
So its correct to say that has six rows.
Give it a try yourself and type M= You will see a six rows vector.
BTW, when you try rows(i) or rows(M[i) you feed the elements 3,4,5 one after the other in the rows() function. Each of these values is a scalar, not a matrix or vector and so the row() function returns 0 for every of these three values and thats the reason for the vector with three zeros you get as a result.
If you want to create a three element vector with the values 3,4,5, here is the way to go
You could also do it that way
but I would recommend the first approach.
You may even do it that way
but I would strongly advise against it.
Thanks. First approach will do.
"If you want to create a three element vector with the values 3,4,5"...
You forgot the simplest one:
and my favourite:
Luc
Yes, you are right. And they also have the benefit of being ORIGIN-independent.
Here are a few more ... 😉
If needed more often, a utility function could be handy
And here a version which should also work in Express