LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to avarage 2D arrays


@sara14 wrote:

When I insert the value of N, even after that it accomplishes the loop and gives the out put, it starts the loop again from zero and runs it 


You don't say if this is what you want or not. If you want to keep averaging over multiple iterations of the outer while loop, place another shift register there and only switch the case structure if the inner and outer iteration terminal are both zero.

0 Kudos
Message 11 of 22
(1,171 Views)

Hi,

Thank you so much again altenbach,

I dont want to average over iterations of outer loop. I want avarage of the inner loop.

Can I put  the N loop and division function (and its display output) all inside a case structure, so that, every time that I hit the switch of the case structure it accomplishes the whole operation for me?

I need to average unknown number of images every time that I hit the button.

 

Sorry if my questions are basic to you, its bcoz I am begginer and my background is not programming

Regards

 

0 Kudos
Message 12 of 22
(1,164 Views)

@sara14 wrote:

...every time that I hit the switch of the case structure it accomplishes the whole operation for me?


What switch?

0 Kudos
Message 13 of 22
(1,159 Views)

Hi altenbach,

by switch button I mean the of boolean for the new case structure

Thank you

Regards

0 Kudos
Message 14 of 22
(1,152 Views)

 

 

Hi altenbach,

My program still has problem.

I want to capture "i" images, remove their red layer, convert to array, take average, and then convert the average to image.

I know that my vi is wrong, and the problem is the way that I take the average and my looping as well.

I want to write the program in such a way that as I hit the Boolean, it start taking "i" images (i is defined by the user), remove their red layer, convert them to array, average them , convert the average array to image and then I stop it by hitting the Boolean again.

I have a snippet of my vi and tried to put it here, but it doesn't allow me to post it here, I dont know how to do it. 

Many thanks for your help

Regards

5.png

0 Kudos
Message 15 of 22
(1,116 Views)
  • Why is the lower shift register not initialzed? Don't you want to use that to count the number of averages? (reset it to zero in the FALSE case).
  • There is a "+1" primitive.
  • Why do you need to hit the button again to stop averaging if you also define the number of averages? Seems redundant and conflicting information.
  • Learns about state machine architecture.
  • Why is there a 1s delay? This could take forever!
  • Why does the outer loop need to spin as fast as the computer allows if the case is FALSE?
0 Kudos
Message 16 of 22
(1,107 Views)

"There is a "+1" primitive" bcoz I want to count the number of iteration and first one is N=0. right?

This average is wrong I am sure,but I dont know how to fix it.

"Why do you need to hit the button again to stop averaging if you also define the number of averages?" bocoz it dosent stop on its own when it averages "i" images.

"Why does the outer loop need to spin as fast as the computer allows if the case is FALSE?" I dont undrestand this. I read somwhere that I should connect it this way.


0 Kudos
Message 17 of 22
(1,092 Views)
  • I mean this one. No need for a diagram constant of 1.
  • You need to divide by the current number of added frames, not the final number. That value is in the lower shift register, right?
  • Well, then you simply need to program monitor the nubmer of averages and trigger the stop condition. As I said, state machine!
  • Where did you read what, exactly??
0 Kudos
Message 18 of 22
(1,079 Views)

When I see such discussions evolving this way, I have always this link-set with useful guides and learning materials for beginners:

http://forums.ni.com/t5/LabVIEW/Idiom-for-initialising-a-sub-VI/m-p/3086564/highlight/true#M882347

If you jump into LabVIEW learning, you will see how much easier you will be able to solve programming tasks...

0 Kudos
Message 19 of 22
(1,070 Views)

"Where did you read what, exactly??" when I put a shift register, I should connect the inlet/outlet tunnels for the false case. 

0 Kudos
Message 20 of 22
(1,068 Views)