Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
You can't find the number of rows here because Data(i) actually is an invalid object, just good enough for display but nothing more.
It may look like a vector but it isn't.
Try to assign it a variable and you will see that you get an error.
What you do can be called a misuse of a range variable because ranges simply are not made for this (even though sometimes it might be convenient).
You may use a utility function which extracts every N-th value from a vector starting with its first value.
So you are dealing with vectors throughout and can use the "rows" function etc.
While I consider it less clear, you may also use an approach similar to the one you used with your range i:
If you insist on using your range i you could do it that way
but I definitely don't like this approach.
I also don't like the syntax "Data(i)" to access vector elements as it look likes a function but isn't. I prefer the "classic" vector/matrix index.
Maybe I can use this
@ppal wrote:
Maybe I can use this
Just for counting?
I guess this
would do the same job.
But you could use your approach to create the "thinned" data vector:
BTW I made a mistake in my previous answer. Its not necessary to use N-1 all the time.
I edited my post accordingly.
You can't find the number of rows here because Data(i) actually is an invalid object, just good enough for display but nothing more.
It may look like a vector but it isn't.
Try to assign it a variable and you will see that you get an error.
What you do can be called a misuse of a range variable because ranges simply are not made for this (even though sometimes it might be convenient).
You may use a utility function which extracts every N-th value from a vector starting with its first value.
So you are dealing with vectors throughout and can use the "rows" function etc.
While I consider it less clear, you may also use an approach similar to the one you used with your range i:
If you insist on using your range i you could do it that way
but I definitely don't like this approach.
I also don't like the syntax "Data(i)" to access vector elements as it look likes a function but isn't. I prefer the "classic" vector/matrix index.