LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the mean of rows and columns matrix

Solved!
Go to solution

hello every body

i have a matrix N*M which some of the elements with only 0 and 1 .

each element which is 1 has (row,column).

I want to find the elments 1 and find the mean of rows which is 1 and also the mean of columns.

thank alot

my email: andisheye20@gmail.com

0 Kudos
Message 1 of 16
(4,830 Views)

hello every body

i have a matrix N*M which some of the elements with only 0 and 1 .

each element which is 1 has (row,column).

I want to find the elments 1 and find the mean of rows which is 1 and also the mean of columns.

thank alot

my email: andisheye20@gmail.com

0 Kudos
Message 2 of 16
(4,746 Views)

Could you create sample matrix with elements of how you are describing and mean of it how it should be calculated?

 

If i understand correctly your question,

-Matrices are nothing but 2D Arrays.

-So first you need to search for the number '1' in 2D array (There are many solutions available if you do search for Search 2D array).

-Then once you get indices you can find mean by using this : http://zone.ni.com/reference/en-XX/help/371361M-01/gmath/mean/

Thanks
uday
0 Kudos
Message 3 of 16
(4,820 Views)

the sample matrix is defined as 

[0 0 0 0 0 0 0

 0 0 0 0 1 1 0

 0 0 0 1 1 1 1

 0 0 0 1 1 1 1

 0 0 0 1 1 1 1

 0 0 0 0 1 1 0

 0 0 0 0 0 1 0]

I want to find the mean of row and column of element which are 1.

for example the mean of this matrix by elemnts 1 is  almost row=4, column=5

0 Kudos
Message 4 of 16
(4,797 Views)

Can you explain how the mean for row is 4?

Thanks
uday
0 Kudos
Message 5 of 16
(4,792 Views)

@andisheye20 wrote:

the sample matrix is defined as 

[0 0 0 0 0 0 0

 0 0 0 0 1 1 0

 0 0 0 1 1 1 1

 0 0 0 1 1 1 1

 0 0 0 1 1 1 1

 0 0 0 0 1 1 0

 0 0 0 0 0 1 0]

I want to find the mean of row and column of element which are 1.

for example the mean of this matrix by elemnts 1 is  almost row=4, column=5


Your usage of the word 'mean' is confusing. Do you mean:

1. The centre of mass of the elements that are '1'? Because the coordinates for the middle of the cluster of 1's appear to be approximately [4,5].

2. The mathematical mean of the values, the same as the average value? This would result in seven row means and seven column means, all values somewhere fractionally between 0 and 1.

3. The 'average' of all x indices and y indices for where elements '1' are located? For example, there are 1's at locations [1,4], [1,5], [2,3], [2,4], [2,5], [2,6], [3,3], [3,4] etc. The means of these indices might be something like the centre of mass mentioned in point 1.

 

If you could be clearer on what you are trying to calculate?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 6 of 16
(4,765 Views)

hello 

I had write the way to achieve the answer for rows

the answer for the column is like the row

the attachment has the writen solution

thanks alot

Download All
0 Kudos
Message 7 of 16
(4,760 Views)

excuseme I want the centre of mass of the elements that are '1'.

but i can not .

would you please help me to write the code.

0 Kudos
Message 8 of 16
(4,757 Views)

-Used search 2d array to get the indices and incremented by 1, beacuse array indices starts with 0.

-Indexed Array to get all rows and coulmns separately and then sent to Mean VI.

Thanks
uday
0 Kudos
Message 9 of 16
(4,751 Views)

sorry sir

you have saved the file in labview15

but my lab is for 2014

would you please save it for labview 2014

0 Kudos
Message 10 of 16
(4,745 Views)