キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Comparing matrix elements

解決済み
解決策を見る

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 件の賞賛
メッセージ1/13
4,625件の閲覧回数

Sounds like a job for Get Matrix Diagonal

 

LowerDiagonal.png 

メッセージ2/13
4,614件の閲覧回数
Do you have any code or data to look at? This would make it much easier to help you.
Tim
GHSP
メッセージ3/13
4,612件の閲覧回数

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 件の賞賛
メッセージ4/13
4,604件の閲覧回数
解決策
受理者 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.

 

 

メッセージ5/13
4,601件の閲覧回数

Ok ! Thank you very much !

 

That was exactly what i was looking for.

0 件の賞賛
メッセージ6/13
4,589件の閲覧回数

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 件の賞賛
メッセージ7/13
3,924件の閲覧回数

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 件の賞賛
メッセージ8/13
3,915件の閲覧回数

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 件の賞賛
メッセージ9/13
3,901件の閲覧回数

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
メッセージ10/13
3,894件の閲覧回数