LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Programming Problem

Solved!
Go to solution

I need to develop a structure on the following condition: where when value of n changes, t should display a value as given below.

 

N ranges from 100 to 1000

T ranges from 35-150

if N>900, T=35

if N>800 and <900, T=40

if N>700 and <800, T=50

if N>600 and <700, T=60

if N>500 and <600, T=70

if N>400 and <500, T=80

if N>300 and <400, T=90

if N>200 and <300, T=120

if N>100 and <200, T=150

0 Kudos
Message 1 of 6
(2,789 Views)

Basic answer: use a Case Structure with as many different cases as you need.

Also: your specifications overlooks multiples of 100; what if N = 400, for example?

Once you defined these intermediate cases, you may also divide N by 100 and use the result to index an array containing the output values.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(2,773 Views)

I'm very new to this field, can you provide an example?

0 Kudos
Message 3 of 6
(2,768 Views)

if n=400 t=80

 

0 Kudos
Message 4 of 6
(2,756 Views)
Solution
Accepted by topic author jtdess5

Personally, I am a fan of using Threshold 1D Array for situations like this.  You get a fractional index, so round down, and then use Index Array to get your T value.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,754 Views)

Thank you for helping me

0 Kudos
Message 6 of 6
(2,749 Views)