cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Find Number of rows

ppal
17-Peridot

Find Number of rows

ppal_0-1717976195844.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ppal)

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.

Werner_E_0-1717981338299.png

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.

Werner_E_2-1717983787105.png

While I consider it less clear, you may also use an approach similar to the one you used with your range i:

Werner_E_3-1717983827484.png

 

If you insist on using your range i you could do it that way

Werner_E_4-1717982980837.png

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.

 

View solution in original post

3 REPLIES 3
ppal
17-Peridot
(To:ppal)

Maybe I can use this 

 

ppal_0-1717981807691.png

 

Werner_E
25-Diamond I
(To:ppal)


@ppal wrote:

Maybe I can use this 

 

ppal_0-1717981807691.png

 


Just for counting?

I guess this

Werner_E_4-1717984086226.png

would do the same job.

 

But you could use your approach to create the "thinned" data vector:

Werner_E_1-1717983672310.png

 

BTW I made a mistake in my previous answer. Its not necessary to use N-1 all the time.

I edited my post accordingly.

 

Werner_E
25-Diamond I
(To:ppal)

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.

Werner_E_0-1717981338299.png

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.

Werner_E_2-1717983787105.png

While I consider it less clear, you may also use an approach similar to the one you used with your range i:

Werner_E_3-1717983827484.png

 

If you insist on using your range i you could do it that way

Werner_E_4-1717982980837.png

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.

 

Announcements

Top Tags