Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 69329

Special array indexing / Making operation on array values depending of the value

$
0
0

Hi,

I'm trying to do in Labview but I'm not sure how write it. Here is the problem to solve:

 

A: a big array of single precision values

limit: a 99x1 vector of integer values (can be single or double if simpler)

v: a 100x1 vector of single precision values

 

result: An array the same size as A

 

The first step, I want to take all the values of A under the first value of limit and multiply it by the first value of v and put it at the same index in the result array. Afterward, I want the values of A greater or equal to the first value of limit but lower than the second value of limit and multiply it by the second value of v. Let's try a simple example to make it more clear

 

A = [1,2;6,3]

limit = [1,3,5,7,8,9]

v = [11,12,3,8,9,4,85]

 

-No values of A under 1

-Two values of A, (1 and 2), between 1 and 3, so I multiply them by 12.

-One value of A, (3), between 3 and 5, so I multiply it by 3.

-One value of A, (6), between 5 and 7, so I multiply it by 8.

-No other values are greater than 7.

 

result = [12,24;48,9]

Any efficient way to do it?

 

Thanks

RMT


Viewing all articles
Browse latest Browse all 69329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>