LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing matrix elements

Solved!
Go to solution

Hello 2 all !

 

I have the following problem : 

 

I have a matrix, in wich "i"  is the index of the rows and "j" is the index of the columns.

 

 I want to see if the elements  of the matrix that are situated below the main diagonal are equal to zero.

 

 

How can i achieve this ?  Any ideas ?

 

Thank you very much 4 your time !

 

 

 

 

0 Kudos
Message 1 of 13
(3,392 Views)

Sounds like a job for Get Matrix Diagonal

 

LowerDiagonal.png 

Message 2 of 13
(3,381 Views)
Do you have any code or data to look at? This would make it much easier to help you.
Tim
GHSP
Message 3 of 13
(3,379 Views)

Thank you 4 your quick answer !

 

Because i'm using labview 8.5, i don't have the "Get Matrix Diagonal" function, so i would very much appreciate an vi containing this function as an example.

 

A example problem would be :

 

 

Given a matrix of the form :

 

 

1  2  3

 

4  5  6

 

7  8  9

 

i would like to find out if the elements situated at the indexes (i,j) : 1,0 ; 2,0 and 2,1 are equal to zero.

 

Thank you very much.

0 Kudos
Message 4 of 13
(3,371 Views)
Solution
Accepted by topic author AndreiN2014

I actually assumed you wanted the first sub-diagonal instead of the lower triangular matrix.   Now you are stuck with indexing.

 

LowerDiagonal.png

 

Here is 8.2 version as well.  After the For Loop the Upper Triangular part plus the diagonal will be zero automatically, if all of the elements are zero then you know the lower triangular part was zero.

 

 

Message 5 of 13
(3,368 Views)

Ok ! Thank you very much !

 

That was exactly what i was looking for.

0 Kudos
Message 6 of 13
(3,356 Views)

I am struggling with extracting the upper triangle of the matrix, do you have any suggestions on how to perform this?  The upper seems more difficult because the index does not start from zero.  I have tried using an array subset and also indexing the array and have had no luck. 

0 Kudos
Message 7 of 13
(2,691 Views)

Post your best attempt at getting it.  Indexing and array subset is all you should need.

 

But when you say you wan the upper triangle, what exactly do you want the output to look like?  Because there is no triangle array in LabVIEW.  Do you want it to be the array but the elements that aren't in the upper triangle to be zeroed out?

0 Kudos
Message 8 of 13
(2,682 Views)

Thank you for your reply RavensFan,

 

My first attempt I tried to get the output in a 3x3 matrix with zeros in the elements that are not part of the upper triangle, such as in Darin.K's example.  I figured this was not possible so i am currently just trying to get the output in a 1 dimensional array.  Either way is acceptable.  

 

I'm pretty sure my logic here is way off base, i'm just stuck and not sure how to get any further.  

 

I am currently taking a data acquisition class and I have minimal (1 semester) experience with labview. 

Thanks in advance!

 

Mike

 

 

labviewmatrix.png

0 Kudos
Message 9 of 13
(2,668 Views)

Hi Mike,

 

did you take the Training resources to learn LabVIEW?

It's basically an exercise on getting array subsets and fill in some zeros:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 13
(2,661 Views)