LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combine For Loops

Solved!
Go to solution

Hi neebie here,

 

This is my first message in the forum. Is it possible to combine these for loop as one?

Loop.png

0 Kudos
Message 1 of 5
(2,939 Views)
Solution
Accepted by Raj_Kumar23

I would sstongly suspect that it could be done

Capture.PNG


"Should be" isn't "Is" -Jay
Message 2 of 5
(2,921 Views)

@Raj_Kumar23 wrote:

This is my first message in the forum. Is it possible to combine these for loop as one?


I think instead of asking how two loops can be combined, you shoud instead tell us how you want to precess the input array and what kind of result you want. Maybe there is a much simpler solution to all of this.

 

I don't quite understand your use of the time. Why do you have diagram constants such as 8:00, but then you are disregarding the minutes completely.

0 Kudos
Message 3 of 5
(2,907 Views)

@altenbach wrote:

@Raj_Kumar23 wrote:

This is my first message in the forum. Is it possible to combine these for loop as one?


I think instead of asking how two loops can be combined, you shoud instead tell us how you want to precess the input array and what kind of result you want. Maybe there is a much simpler solution to all of this.

 

I don't quite understand your use of the time. Why do you have diagram constants such as 8:00, but then you are disregarding the minutes completely.


A Look at the excellant sample data showed that the data is collected at 15 points once each hour-  the minutes are meaningless.  (and the timer relatively inacurate)

 

From that we could infer "something" about the desired user's story.  It might not be how I'ld do it but the second loop was not really needed as every bit of data in it was available in the first loop.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 5
(2,889 Views)

I agree that it looks simple at first glance, but there could be many scenarios where the code could fail unless we make many assumptions about the input data. For example, if the date (or just AM vs PM) would change between rows, we would get quite a bit of ambiguity and malfunction. The code in the current form is not universal or safe because significant amounts of information is discarded.

 

In the most general case, the entire first column would need to be parsed as timestamp datatype.

 

If only the hours matter, a simple numeric diagram constant would suffice. Having a string formatted with minutes that are later ignored just adds to the confusion and hampers code readability.

0 Kudos
Message 5 of 5
(2,879 Views)