LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why a normalized vector VI gives value with -1 ?

Solved!
Go to solution

I have a 2d array pf 360x360

with a good and proper image forming

now I used this to normalize that array so it comes b/w 0 and 1 and not <0

 

whereas it is giving values <0

 

gptshubham595_0-1611295436075.png

 

gptshubham595_2-1611295522705.png

 

 

original matrix don't have any -ve values

 

gptshubham595_3-1611295686592.png

 

0 Kudos
Message 1 of 6
(1,414 Views)

Hi gpt,

 

you are starting one thread after the other, but you fail to take advice (aka "fail to learn from suggestions") as given here.

Please cleanup code before posting!

Please provide real code instead of images of code!

Please provide code with example data included!

 


@gptshubham595 wrote:

now I used this to normalize that array so it comes b/w 0 and 1 and not <0


Why do you use a matrix function when you want to use a simple InRangeAndCoerce operation???

Or do you want to calculate simple math like

y = (x - min(x))/(max(x) - min(x))

with y and x being 2D arrays?

After taking basic LabVIEW training you should have heard of polymorphism…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,403 Views)

Yes for sure I'm trying to learn and get basic training of LabVIEW!

Being a bit new to this makes 

from normalization I mean

 

summation of all elements of a row and divide each element with this sum

 

like

1 2 3 = 1+ 2 +3 =6   =>1/6 , 2/6 , 3/6

4 5 6 = 4+ 5 +6 =15   =>4/15 , 5/15 , 6/15

7 8 9

0 Kudos
Message 3 of 6
(1,394 Views)
Solution
Accepted by topic author gptshubham595

Hi gpt,

 


@gptshubham595 wrote:

from normalization I mean

summation of all elements of a row and divide each element with this sum


Use an autoindexing FOR loop to iterate of the rows of your 2D array.

Inside the loop you calculate the sum of the row (ArraySum) and divide the row by that sum

Then output the scaled row values using an autoindexing tunnel to get the resulting "normalized" 2D array…

 

Pretty basic stuff involving loops, autoindexing, polymorphism.

Did you take the basic Training resources as offered in the header of the LabVIEW board?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(1,392 Views)

I know this method, and solved by this

but thought that is it not possible with a single builtin VI?

 

Thank you for valuable suggestions

 

oh! will follow that

 

till now I was following youtube 😅

0 Kudos
Message 5 of 6
(1,389 Views)

If you could do everything with a single built-in VI, there'd be no reason to ever program anything.

 

I don't trust youtube videos for LabVIEW.  Many of the videos I see are of poor quality, you can't understand the speaker, and they promote poor programming practices.

0 Kudos
Message 6 of 6
(1,353 Views)