Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I'm trying to pull G number of rows from an array. The For loop is not working. It gives me the whole array instead.
Solved! Go to Solution.
In your attempt you never access a single row of the matrix. Here some comments:
I assume that when G=3 you want the program to return the top three rows of your matrix - independent from the setting of ORIGIN.
If you insist on using a for-loop you could do it that way using the row operator:
Personally I would prefer using a more generic utility function where the number of rows is an additional function argument:
But what exactly do you have against the "submatrix" function?
P11 file attached
Hi,
ORIGIN is set to default of 0. G=3 means fourth row.
Use the submatrix() function.
Cheers
Terry
Yeah, I did the same. I thought I should be able to do the same with a for loop.
In your attempt you never access a single row of the matrix. Here some comments:
I assume that when G=3 you want the program to return the top three rows of your matrix - independent from the setting of ORIGIN.
If you insist on using a for-loop you could do it that way using the row operator:
Personally I would prefer using a more generic utility function where the number of rows is an additional function argument:
But what exactly do you have against the "submatrix" function?
P11 file attached
Thank You. I like the method of calling out the number of rows in the function's argument.
Nothing against the submatrix command. But your programming is more intuitive for me.