Skip to main content
18-Opal
January 20, 2023
Solved

How to Find Number of Rows

  • January 20, 2023
  • 2 replies
  • 3424 views

Prime 8 . No file attached. Trivial inputs. How do I get 3 ?

ppal_0-1674181036176.png

 

 

 

 

 

Best answer by terryhendicott

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

2 replies

21-Topaz II
January 20, 2023

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

18-Opal
January 20, 2023

ppal_0-1674185298297.png

 

25-Diamond I
January 20, 2023

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

Werner_E_0-1674184887686.png

You could also do it that way

Werner_E_1-1674184947262.png

but I would recommend the first approach.

You may even do it that way

Werner_E_0-1674185070002.png

but I would strongly advise against it.

 

 

 

18-Opal
January 20, 2023

Thanks. First approach will do.