Rank: Member Groups: Registered
Joined: 13/11/2020(UTC) Posts: 28 Was thanked: 7 time(s) in 3 post(s)
|
Hi guys Do you know how to get the number of a row in an array? ie I have a 5 * 2 array, I want to know what is the number of a particular row ¿Cómo se obtiene el número de una fila, de una matriz? How do you get the number of a row, of a matrix? I do not speak English, I hope you can understand me with the following image
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 127 time(s) in 82 post(s)
|
Hello Valentino! This snippet downloaded from the forum long time back. Credit to the author, but cannot remember. There may be other short cuts too. Cheers..... |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
2 users thanked ndtma for this useful post.
|
on 06/05/2021(UTC), on 11/05/2024(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 127 time(s) in 82 post(s)
|
To find the indices of an array of values. Cheers..... Find_Row_Num.sm (96kb) downloaded 26 time(s). |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
3 users thanked ndtma for this useful post.
|
on 27/03/2021(UTC), on 06/05/2021(UTC), on 11/05/2024(UTC)
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Member Groups: Registered
Joined: 13/11/2020(UTC) Posts: 28 Was thanked: 7 time(s) in 3 post(s)
|
Originally Posted by: ndtma Hello Valentino! This snippet downloaded from the forum long time back. Credit to the author, but cannot remember. There may be other short cuts too. Cheers..... Thank you very much, it worked perfectly for me, the method you teach is very useful. Thanks for taking the time and sharing your ideas.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Alternative (needs special functions plugin): Or in one line:
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Valentino Do you know how to get the number of a row in an array? i.e: I have a 5 * 2 array, I want to know what is the number of a particular row
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/11/2021(UTC) Posts: 18
|
hey, i have a some problem. i hope someone can solve this problem too. in the first exampe "match" its not working but in the second example it works. i dont know why
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,129 Was thanked: 510 time(s) in 340 post(s)
|
Originally Posted by: Beyaz hey,
i have a some problem. i hope someone can solve this problem too.
in the first exampe "match" its not working but in the second example it works. i dont know why Hi Beyaz, For first warning, row() expect a real pure number for second argument. Your findrows() result is a number with N unit. Due to your second problem; I think commas in your subscripts makes the bug. When they are deleted, your function match() works. Regards PS: Please provide your problematic file next time. Rewriting your entire screenshot is cumbersome. match.sm (11kb) downloaded 9 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/11/2021(UTC) Posts: 18
|
Originally Posted by: overlord Originally Posted by: Beyaz hey,
i have a some problem. i hope someone can solve this problem too.
in the first exampe "match" its not working but in the second example it works. i dont know why Hi Beyaz, For first warning, row() expect a real pure number for second argument. Your findrows() result is a number with N unit. Due to your second problem; I think commas in your subscripts makes the bug. When they are deleted, your function match() works. Regards PS: Please provide your problematic file next time. Rewriting your entire screenshot is cumbersome. match.sm (11kb) downloaded 9 time(s). thanks overlord sorry, you are right, next time i will add the file. i tried it but it doesnt work. this time i add the file. vogt.sm (637kb) downloaded 3 time(s).//I solved it like this Edited by user 28 July 2023 22:49:41(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,129 Was thanked: 510 time(s) in 340 post(s)
|
Your while loop shouldn't produce E.rkx. At least my computer doesn't. There should be an E.rkx output at end of it. I would solve eval() problem like this. Regards
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Attach an image of a typical 6 x 4 matrix 4 decimals. From there, say what you want to extract. That will ease the guidance, while avoiding confusion.
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/11/2021(UTC) Posts: 18
|
hey guys, Your suggestions were very helpful, but is it possible to rewrite the function so that strings are also can be match. Im looking for the Index of "b" ->[2] KLED.sm (5kb) downloaded 1 time(s).Edited by user 05 January 2024 22:39:44(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,990 Was thanked: 1128 time(s) in 724 post(s)
|
The result of findrows() is a matrix, even if there is only one match (exept for no matches, then the result is the number zero) Converting it to a scalar, seems to help. The same could be applied to the overall result to remove the matrix. Yet, there is a shorter way to get the index. This, however, won't work for multiple matches. KLED.sm (7kb) downloaded 0 time(s). |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.