LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement this code in labview?

How do implement this pseudo code in labview? Please keep in mind "a" and "c" in the code below ARE VARIABLES

 

for i =0 to i=maxvalue

       if i <= a 

           output = output2

       else if i > a AND i<=c

           output = output2

       else if i < c 

           output = output3

       else i = d

           output = output4

 

I understance i can use a case structures and modify the label, but i do not know how to make the label dependent on a variable value. 

 

Thanks 

0 Kudos
Message 1 of 21
(3,936 Views)

@hpupo wrote:

How do implement this pseudo code in labview? Please keep in mind "a" and "c" in the code below ARE VARIABLES

 

Thanks 


Sounds like you need to look at the basic LabVIEW tutorials available online. It might take some effort to think of things in terms of data flow and not variables.

0 Kudos
Message 2 of 21
(3,927 Views)

Thanks for the quickly reply. I wish i had the time to do that. I am running on a very tight schedule adn unfortunately can't afford to learn how to think in labview mode, so i was hoping there was a an easy solution for this problem.

Thanks

0 Kudos
Message 3 of 21
(3,921 Views)

Feel free to post what you have so far so that we can give you better advice.

0 Kudos
Message 4 of 21
(3,917 Views)

Try an array of boudaries and use threshold array. See this old example:

 

 

Now just iterate over an array of values using a FOR loop.

Message 5 of 21
(3,905 Views)

@hpupo wrote:

. . . I am running on a very tight schedule adn unfortunately can't afford to learn how to think in labview mode, so i was hoping there was a an easy solution for this problem. . .


The solution is pretty easy depending on a few key parameters. You'll get help here if you're willing to take the time to learn LabVIEW. If you're just looking for solution code, you won't get that here.

 

For your present problem: How quickly do you want to run through the indices in i? You're going to need a for loop for that. For checking a and c, you're likely going to want to poll the values of controls inside of the for loop. Sounds like you have the basics of what you'd like to put in your case structure.

 

Go ahead and take a stab at it and post what you think the solution might look like.

0 Kudos
Message 6 of 21
(3,894 Views)

Let the responses begin.  Smiley Happy

 

Capture.JPG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 21
(3,882 Views)

There is nothing intrinsically wrong with that solution at all.

0 Kudos
Message 8 of 21
(3,868 Views)

@tyk007 wrote:

There is nothing intrinsically wrong with that solution at all.


What solution? This thread contains many posts!

0 Kudos
Message 9 of 21
(3,859 Views)

I am definetely into learning and changing my way of thinking, the only thing, like i mention is that unfortunately i do not have the time right now. 

This is what i ahve so far. Keep in mind i have not tested it, but in principle it should eb correct. 

0 Kudos
Message 10 of 21
(3,852 Views)