Search in matrix

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

 

I would be grateful for some help for beginner user :

 

I have a matrix :


m1 = [ 1, 2, 3;
4, 5, 6;
7, 8, 9]; // A 3 by 3 matrix

And I would like to seek a specific number (6) and get values from row where '6' exists ?

Is in hypermath a dedicated function for searching inside the matrix ? or how to do it different ?

 

 

Thanks in advance 

 

 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited September 2015

    Hi,

    I actually do not ever use hypermath. just see no answer for long time

    i found in help of hypermath (you can read more by open help>Hyperworks help home> Hypermath

     

    index a matrix by matrix_name(row,col)

    so search for a specific number in matrix by two loops

    for i = 0 to row 

    for j=i to col

     

    another way is convert a matrix to a tcl list and do searching by lsearch

    please look for how to convert hypermath to tcl in help of hypermath

    and also you need some knowledge about tcl list. access tcl global page for manuals