Find Number of rows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Labels:
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Maybe I can use this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
