LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the position of element of a matrix

Hi,

 

I have a question to ask you.

 

I have a matrix N x M which contains a large number of zero. I wish to find the position of the element not equal to zero and to classify them in a table of two columns: line of the matrix and the column of the matrix. I do not need the value of the element.

 

Do you know how I have to proceed?

 

Thanks for help

0 Kudos
Message 1 of 4
(2,184 Views)

hello marmotte,

 

here you go:

2013-05-23_non-zero.png

 

 

 

 

 

Alex

Message 2 of 4
(2,169 Views)

Matrix data type in LabVIEW is similar as an Array data type, you can use nested For loops to extract individual elements of the matrix and then just check if it is a non-zero element and if so store the iteration ('i' terminal) of both the loops... that will give you the row ('i' terminal of outer loop) and column ('i' terminal of inner loop) index of each non-zero element.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 3 of 4
(2,164 Views)

If you are using LabVIEW 2012, it can be a bit more easier. I have used round to nearest integer as there are caveats in comparing floating point numbers.

Here:

Matrix.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 4 of 4
(2,159 Views)