LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array trend pattern

Dear all,

 

I would like to count the rising trend of array inputs. Attach is a VI to find the maximum value of array inputs and replace the highest value in the two array sets.

 

It compares element versus element in the arrays. Is there any way i can calculate the number of occurences the value has been increasing for each element in the arrays and return the results in array.

 

 

Say example;

 

 1st Input:  1  2  3  4  5

 

 2nd Input :2  4  6  8  10

 

 3rd Input:  1  1  1  1  1

 

 4th Input:  3 6   8  9  11

 

 

The trend answer is: 2  2  2  2  2

 

 

initZeros.png

 

 

  Thank you!

 

 

 

 

 

0 Kudos
Message 1 of 9
(4,196 Views)

Hi newbie,

 

You should have mentioned that requirement in the other thread

The first solution provided   by for(imstuck) would then be in the right direction.

 

Will the number of elements in the array change?  Also, provide any other constraints or requirements so that a single solution can be provided.  

 

As the requirements change, so does the code or the architecture of the code...

0 Kudos
Message 2 of 9
(4,182 Views)

Dear Raven,

 

The requirement stay about the same except that it should also provide the user a choice also to reject any non rising trend and reset the counting again.

 

Example:

 

1st Input:  1  2  3  4  5

 

 2nd Input :2  4  6  8  10

 

 3rd Input:  1  1  1  1  1

 

 4th Input:  3  6   8  9  11

 

 5th Input:  4  7   9  10  12

 

 

The answer now is:  1  1  1  1  1

 

 

0 Kudos
Message 3 of 9
(4,175 Views)

Dear Raven,

 

The requirement stay about the same except that it should also provide the user a selection also to decide whether a not to reject any non rising trend also and reset the counting again. 

 

 

Example (Reject non rising trend):

 

1st Input:  1  2  3  4  5

 

 2nd Input :2  4  6  8  10

 

 3rd Input:  1  1  1  1  1

 

 4th Input:  3  6   8  9  11

 

 5th Input:  4  7   9  10  12

 

 

The answer now is:  1  1  1  1  1

 

 

 

 

 Example ( Accept non rising trend)

 

1st Input:  1  2  3  4  5

 

 2nd Input :2  4  6  8  10

 

 3rd Input:  1  1  1  1  1

 

 4th Input:  3  6   8  9  11

 


 

The answer now is:  2 2 2 2 2 

 

 

 

The array size will not change. Thank you!

 

0 Kudos
Message 4 of 9
(4,173 Views)

newbieboy,

 

It appears that you're using the LV forum to get your homework done.

This question begins with the solution you were provided yesterday.

Similarly, your other recent question also looks very much like homework.

 

Did you even search for similar topics before posting this continuation question?

 

LabVIEW 5.0 seems so long ago...
0 Kudos
Message 5 of 9
(4,170 Views)

Dear Jones,

 

For the questions you pointed out on the VISA question (solution) i post, i am trying to find a shorter way to reduce the code which i had written in long format. I hope to write something shorter and more efficient to run. Hopefully i can learn some useful and shorter techniques to write the code more efficiently. I try to search but cant find anything similar.

 

Thank you!

 

 

0 Kudos
Message 6 of 9
(4,134 Views)

I'm still trying to understand the requirements..

 

You want a button to accept or reject rising trends, and another button to reset. 

So what do you mean by accepting non rising trends?  I'm looking at your examples and didn't undertand the meaning..

0 Kudos
Message 7 of 9
(4,093 Views)

Dear Ray R,

 

Thanks for enquiring me back on the doubts that you have. Firstly, i would like to give my utmost  thanks to you for coming back to me on my question. I think i did not really make my question very clear in the first place and make it difficult for you to help me. I would also like to thank else191 and for(imstuck) for helping me in the previous threads. In the previous examples, i have also learn some cleaner and faster ways of coding from you all. Kudos to you all.

 

 Ray, you have also given me some hints on how to do my application. I have given some try based on the hints and manage to code the program based on my requirements. It may not be elegant but at least i have tried to code it finally.

 

Basically, my application involves two parts with "Rising Trend" as control.

 

With rising trend on, it will count the number of times the array elements increases. However if there is any fall in value in between, the counter and max will be reset to zero.

 

With rising trend off, it will count the number of times the array element increases inregardless of whether there is a dip in between. It will just keep counting for any higher values.

 

  test.png

 

 

Thanks all for the help!

 

0 Kudos
Message 8 of 9
(4,077 Views)
0 Kudos
Message 9 of 9
(4,041 Views)