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

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Encontrar valor en columna en una matriz

Ycarlos
12-Amethyst

Encontrar valor en columna en una matriz

Hola a todos, Soy nuevo en publicar aquí.

Como puedo encontrar el valor que le corresponde a un numero de una matriz (buscar) en una columna de una matriz X. en caso que el numero se repita varias veces se pueda poner el máximo y mínimo para ese numero.

Gracias de antemano por la atención prestada.

Matris.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

ACCEPTED SOLUTION

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

¡Bienvenido al foro de Mathcad/Prime!

 

What you describe can be easily achieve using Primes various Lookup functions -> Lookup Functions

But what you picture shows sure is different would need some programming and also needs a more precise description of what you actually try to achieve.

As an example: Your vector Duscar contains twice the 4 and I see and assume that you want that the first and the last occurrence in the matrix X should be returned.

What should be returned if the 4 is present only once in Duscar?
What should be returned when the 4 is present three times in X?

 

In case you only inserted the two 3's and 4's and 11's because you "see" that these values occur multiple times and you are only interested in the first and last value, then it should not be necessary to do so - the program should automatically act accordingly if a values occurs multiple times in the first column of vector X.

 

Here is a first attempt:

Werner_E_1-1696792045774.png

 

Next time you should give it a try yourself, set up a worksheet and post it here!
You also should state which version of Prime you are using, because a file  made by a newer version cannot be read by an older one and there is no official way to convert it.

The attached file is in Prime 6 format, so I guess chances are high that you use a newer version and are able to open it.

 

EDIT: Added the try&catch to trap the error which would occur if the vector D contains a number not present in the first column of matrix X. Wrong numbers are simply skipped/ignored like the 6 I added in the vector D.

View solution in original post

1 REPLY 1
Werner_E
25-Diamond I
(To:Ycarlos)

¡Bienvenido al foro de Mathcad/Prime!

 

What you describe can be easily achieve using Primes various Lookup functions -> Lookup Functions

But what you picture shows sure is different would need some programming and also needs a more precise description of what you actually try to achieve.

As an example: Your vector Duscar contains twice the 4 and I see and assume that you want that the first and the last occurrence in the matrix X should be returned.

What should be returned if the 4 is present only once in Duscar?
What should be returned when the 4 is present three times in X?

 

In case you only inserted the two 3's and 4's and 11's because you "see" that these values occur multiple times and you are only interested in the first and last value, then it should not be necessary to do so - the program should automatically act accordingly if a values occurs multiple times in the first column of vector X.

 

Here is a first attempt:

Werner_E_1-1696792045774.png

 

Next time you should give it a try yourself, set up a worksheet and post it here!
You also should state which version of Prime you are using, because a file  made by a newer version cannot be read by an older one and there is no official way to convert it.

The attached file is in Prime 6 format, so I guess chances are high that you use a newer version and are able to open it.

 

EDIT: Added the try&catch to trap the error which would occur if the vector D contains a number not present in the first column of matrix X. Wrong numbers are simply skipped/ignored like the 6 I added in the vector D.

Announcements

Top Tags