08-19-2014 11:37 AM - edited 08-19-2014 11:37 AM
Here's my solution for the original problem. The second problem can be solved similarly.
08-19-2014 11:50 AM - edited 08-19-2014 11:51 AM
And here's what you would do for the second problem. All you need to do is change the 2D array diagram constant to a control with however many rows you need, one per iteration. Of course the 2D array output can be left out in the final code if only the final 1D array is needed.
08-20-2014 11:53 AM
Hi Altenbach,
Many thanks for your help, very appreciated.
Unfortunately I did not managed to get your code to work in my state machine. When I connect it to my data array, the final array does not accumulate the values every time the state is executed. It gets stuck. I can send you a screenshot
So based on your example I replace the shift registers by tunnels and -Please see the picture attached- and added an extra gate and to feed a register that should accumulate the result from the previous operation. So the first adder does give me the elements that match the value "in 1s", that is okay, the problem is to add that to the overall count and feed it through the nex iteration. Using shift registers would be in theory the solution but I cannot get it to work. The register with the overall result does not seem to accumulating the data, seems empty.
I do not know what to do to be honest. It must be a simple solution but dont find it, Is it understandable what I am trying to do?
Thanks for your time
08-20-2014 11:59 AM - edited 08-20-2014 12:00 PM
Hi Rcano,
you have been given a lot of solutions and hints to your problem, but you fail to integrate them in your code.
Either integrate the solutions as they are provided (without altering them in the process) or attach your VI so someone else may do that for you…
08-20-2014 12:39 PM
Hi GerdW
Please see attached.
Thanks for your time.
Regards
08-20-2014 02:04 PM
08-20-2014 02:38 PM
@Rcano_1982 wrote:
Hi Altenbach,
Many thanks for your help, very appreciated.
Unfortunately I did not managed to get your code to work in my state machine.
The code picture you posted has no resemblance whatsover to my suggestions and examples.
08-22-2014 07:17 AM
Hello there,
Thanks to both GerdW and Altenbach.
Altenbach your solution worked in my design, sorry for modifying it, I was trying anyting to make it work.
All what was going on was very silly, One of the wires on one of the states was not wired accross, so data was lost when executing that state.. A newie mistake I suppose. Thanks for the support it has helped to improve my skills in LV
08-22-2014 10:30 AM
Rcano_1982 wrote:All what was going on was very silly, One of the wires on one of the states was not wired accross, so data was lost when executing that state.. A newie mistake I suppose. Thanks for the support it has helped to improve my skills in LV
That's why we highly prefer to always see the entire VI. A truncated picture of a code segment cannot be used for troubleshooting. 😄