LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure with value changes

Solved!
Go to solution

How did you get the values ( 0, 2, 2, 4, 4 ), can you show me the code for that ?

 

Message 41 of 92
(1,555 Views)
Its the result from the code which i posted as a picture in the previous reply
0 Kudos
Message 42 of 92
(1,553 Views)

Try to make a code that uses the last found index + 1 as a starting point for the next array search.

As a tip, you need to use a shift register and a +1 function.

0 Kudos
Message 43 of 92
(1,550 Views)

@Bombbooo wrote:

@ Ray-R

 

Ok I'll try to explain it pretty clearly again. The purpose of this vi is to make to user be able to change the unit (Flow unit and Pressure unit). When he change the unit (for example; flow unit), all flow values should change to be correct values (ex. 4 L/min = 240 L/hr). All changes should occur in the same array. As you can see in my vi or the posted picture, I tried to arrange the array of all names from the daya mainstream, then I made the array if index number where the values change and so on... If you understand, could you please take a look at my code? and give me some suggestions or fix my code to reach the goal I expected?

 

Thank you


So it's simply a unit conversion software.  The block diagram made it look more complex and I thought I was missing something.

I'll have another look at your code and hopefully suggest something more elegant.

0 Kudos
Message 44 of 92
(1,546 Views)

You are right, and one could make it a lot more elegant.

But then the OP would never learn to analyze and debug his own code. I think that is a bigger part of the problem.

 

Spoiler
NiceSolution.png

 

 

 

 

 

Message 45 of 92
(1,543 Views)

So the original code you posted will only change the 1st "Pres" value when you change the Flow Unit, which is not what is expected, because it should change the "Flow" and not the "Pres".  Furthermore, if I understand the tid-bits along this thread, when you change either the "Flow unit" or the "Pressure unit" you would want all the corresponding values to change within the cluster.

 

Is the above right?  If so, that's what I meant about the description.  It was obvious that changing the "Flow unit" did something..  😉

 

So do you care about the "No" values at this time?  or the Save & Active indicators?  Or will you be taking care of those later?  In other words, does changing values inside the cluster trigger any event?

 

For now, I will simply concentrate on the fact that the code would respond only to changes to the "Flow unit" & "Pressure unit". 

 

A hint is that the Event Structure did not include handling of the "Pressure unit" change event.. 😉

Message 46 of 92
(1,550 Views)

@dkfire wrote:

You are right, and one could make it a lot more elegant.

But then the OP would never learn to analyze and debug his own code. I think that is a bigger part of the problem.

 

 

 

 

 

 


You cheated...  😄  LOL!!

 

Now he would need to implement the other event case..  And what is in the false case (really simple)..

 

Well...  on the other hand, you saved me the trouble of writing all the things he/she would need to change in the code..  😉

 

Well done.

0 Kudos
Message 47 of 92
(1,549 Views)

Ray.R

 

I had it all the time from the begining of my response to this thread. 😉
But I didn't want to share it, as the OP might not learn anything from just looking at my code.

And I was trying to go through the code step by step correcting all the things that is wrong/not perfect, but by letting the OP do all the work.;-o

And then you came, telling you wanted to give the OP some code, so thinking you would give a solution, I gave mine.

0 Kudos
Message 48 of 92
(1,545 Views)
Alright thank you for all coming to help me. I really want to learn but it's pretty hard for me to analyze the problem by my own becoz i'm pretty new to this software.

The buttons "no" and "active" are used for other purposes in my other sub vi. So it doesn't matter in this case.
0 Kudos
Message 49 of 92
(1,541 Views)
I know there is no event structure for pressure unit. But i can simply copy from flow event structure.
0 Kudos
Message 50 of 92
(1,538 Views)