04-03-2012 11:11 AM
How did you get the values ( 0, 2, 2, 4, 4 ), can you show me the code for that ?
04-03-2012 11:13 AM
04-03-2012 11:16 AM
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.
04-03-2012 11:20 AM
@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.
04-03-2012 11:32 AM
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.
04-03-2012 11:36 AM
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.. 😉
04-03-2012 11:37 AM - edited 04-03-2012 11:39 AM
@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.
04-03-2012 11:46 AM
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.
04-03-2012 11:56 AM
04-03-2012 12:07 PM