Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Valentino  
#1 Posted : 27 March 2021 05:40:35(UTC)
Valentino


Rank: Member

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 28
Man
Mexico

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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline ndtma  
#2 Posted : 27 March 2021 06:33:17(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
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.....

Find_Row_Num.png
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
thanks 2 users thanked ndtma for this useful post.
on 06/05/2021(UTC),  on 11/05/2024(UTC)
Offline ndtma  
#3 Posted : 27 March 2021 13:32:48(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
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).

Find_Row_Num2.png
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
thanks 3 users thanked ndtma for this useful post.
on 27/03/2021(UTC),  on 06/05/2021(UTC),  on 11/05/2024(UTC)
Offline Jean Giraud  
#4 Posted : 27 March 2021 14:33:47(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Valentino Go to Quoted Post
Do you know how to get the number of a row in an array?

These 4 are from a much larger compendium.
You will go a long route with them.
Jean

Utilities Matrix Truth Table [Locate row_col].sm (46kb) downloaded 16 time(s).
Utilities Matrix Locate Array1 Array2.sm (71kb) downloaded 11 time(s).
Utilities Matrix Truth Table [Locate row_col] COMPANION.sm (154kb) downloaded 13 time(s).
Utilities Matrix Treasury_1.sm (424kb) downloaded 12 time(s).
thanks 1 user thanked Jean Giraud for this useful post.
on 06/05/2021(UTC)
Offline Valentino  
#5 Posted : 06 May 2021 13:35:13(UTC)
Valentino


Rank: Member

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 28
Man
Mexico

Was thanked: 7 time(s) in 3 post(s)
Originally Posted by: ndtma Go to Quoted Post
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.....

Find_Row_Num.png


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.
Thank you
Offline MarB  
#6 Posted : 06 May 2021 14:21:02(UTC)
MarB


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):

match.png

Or in one line:

match2.png
Offline Jean Giraud  
#7 Posted : 06 May 2021 15:49:36(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Valentino Go to Quoted Post
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


Array.PNG

Offline Beyaz  
#8 Posted : 27 July 2023 22:04:49(UTC)
Beyaz


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

Unbenannt.PNG


Offline overlord  
#9 Posted : 28 July 2023 04:14:46(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,129
Turkey

Was thanked: 510 time(s) in 340 post(s)
Originally Posted by: Beyaz Go to Quoted Post
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).

2023-07-28_04-06.png
Offline Jean Giraud  
#10 Posted : 28 July 2023 15:27:38(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
More utilities were designed and available.
These 4 will go a long route ... projects.
Created Studio, sanity checked Solver 30405.

Utilities Matrix Locate Array1 Array2.sm (71kb) downloaded 6 time(s).
Utilities Matrix FindIndex DUAL COMPANION Copy.sm (109kb) downloaded 3 time(s).
Utilities Matrix FindIndexKey COMPANION QUICK Copy.sm (90kb) downloaded 3 time(s).
Utilities Matrix FindIndexKey COMPANION QUICK.sm (90kb) downloaded 5 time(s).
Offline Beyaz  
#11 Posted : 28 July 2023 22:32:39(UTC)
Beyaz


Rank: Member

Groups: Registered
Joined: 12/11/2021(UTC)
Posts: 18

Originally Posted by: overlord Go to Quoted Post
Originally Posted by: Beyaz Go to Quoted Post
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).

2023-07-28_04-06.png




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
122.PNG

Edited by user 28 July 2023 22:49:41(UTC)  | Reason: Not specified

Offline overlord  
#12 Posted : 28 July 2023 23:03:03(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,129
Turkey

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

2023-07-28_23-01.png
Offline Jean Giraud  
#13 Posted : 29 July 2023 14:22:05(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

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.
Offline Beyaz  
#14 Posted : 05 January 2024 22:37:40(UTC)
Beyaz


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).
Screenshot 2024-01-05 093421.png

Edited by user 05 January 2024 22:39:44(UTC)  | Reason: Not specified

Offline mkraska  
#15 Posted : 06 January 2024 09:48:08(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,990
Germany

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.png KLED.sm (7kb) downloaded 0 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Users browsing this topic
Guest
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.