02-16-2018 03:28 AM
Hi,
In one cycle of operation, there are two steps.
I have 2 case structures inside while loop. one case structure will be true for each step.
I need to build array , so that two case structure values to be in one row. currently I built two arrays to get values. Any idea ?
02-16-2018 07:48 AM
you need "build array" 🙂
02-16-2018 09:11 AM - edited 02-16-2018 09:12 AM
The problem statement had the different cases providing data on different iterations.
Here is the solution. Store the previous iteration value in a shift register on the 0, 2, 4, .... iterations. Combine the previous and the new value into the 2-D array on the 1, 3, 5, ... iterations
02-16-2018 09:53 AM - edited 02-16-2018 10:21 AM
@prabhu91 wrote:In one cycle of operation, there are two steps.
I have 2 case structures inside while loop. one case structure will be true for each step.
I need to build array , so that two case structure values to be in one row.
You are leaving out a lot of information and most statements are ambiguous:
What is a cycle? An iteration of the loop? In the subject you want to only build every two iterations. What should happen at the other iterations? So you have two case structures? Which one is true? What is a step? Is it always the same case structure that is true? Should they alternate to be true? Is always one true and one false? (in that case you probably only need one case structure with the two alternatives in the two cases). What's in the other case of each?
@prabhu91 wrote:
currently I built two arrays to get values. Any idea ?
Why don't you shows us the VI you currently have, then tell us what output you want.
02-16-2018 10:11 AM
Do I understand correctly that you are alternating between different cases each iteration? Just wire the outputs in each case to the same indexing output tunnel on your while loop. If you have two unique case structures, then wire them each to their own output tunnel, with the conditional terminal enabled. Wire a boolean through a shift register and flip its state each iteration with the Not operator, and use that line on the conditional terminals - one before the Not function and one after. Then, you interleave the two arrays after the while loop completes.
02-16-2018 10:12 AM
Sorry - that snippet wasn't supposed to be included. It illustrates the point though - just replace the single case structure shown with your two individual structures.
02-17-2018 08:55 AM
Hi,
Please find the vi.
02-17-2018 09:22 AM
Thanks for the reply.
Mr.revansfan.
But I could get the solution. if possible replace it in my vi. also replace random number with numeric constant.
I changed the two step process to single step. so i managed to program that.
And
Thanks everyone.
02-17-2018 10:24 AM
Are you saying you could get the solution? Or could not?
The VI you posted right before this looks nothing like what I posted based on the image. And that image is a snippet, so you can actually save the .png file to your hard drive, then drag that file into your block diagram and you'll have the actual code.
02-17-2018 10:39 AM
@prabhu91 wrote:
Hi,
Please find the vi.
This VI make certain beginner mistakes, complicated the code. I guess you found a better final solution. Can you post it? Thanks!