ciomp Posted April 8, 2006 Report Share Posted April 8, 2006 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 i have a 5*4array like that .what could i do to change it to the following: 1 1 2 2 3 3 4 4 5 5 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 16 16 17 17 18 18 19 19 20 20 Quote Link to comment
Mike Ashe Posted April 8, 2006 Report Share Posted April 8, 2006 Okay, we agree you'd like to do that. What have you tried so far that did not work? Obviously you need to do some work with nested loops. Sketch out the algorithm first then try a couple of things. If you don't get it report back what you tried and didn't work and we'll probably help. Quote Link to comment
mross Posted April 8, 2006 Report Share Posted April 8, 2006 Sounds more like a homework problem than real work, but I will give it to you. You will want to use the standard "Interleave 1D Arrays" function. Each row is "deleted" (by Delete from Array) from the original 2D array and interleaved with itself. A shift register of the outer For Loop is used to build the resulting interleaved arrays back into the form you like. That is the plan. I will let you work out the details. Prove you aren't just cheating on your school work (explain why this is important to you) and I can show you how it is done. Mike Quote Link to comment
ciomp Posted April 8, 2006 Author Report Share Posted April 8, 2006 i have do some work like this ,please give me some advise Download File:post-4693-1144478868.vi Quote Link to comment
mross Posted April 8, 2006 Report Share Posted April 8, 2006 i have do some work like this ,please give me some advise You have a While Loop. You need to use For Loops that run contingent on the Count Terminal or in the case of the final For Loop it automatically looks at the array size wired into the loop (with indexing enabeled). There are probably a lot of other ways to do this with more or less work. You need to study how data flows in a labview block diagram. The small light bulb icon runs the VI in a step through mode so you can wahtch and learn how it functions. Data flow means each functional element runs when all the input data wired to it arrives, including the loops. It is not a sequential programming language unless you force it to be so. You can also right click on wires and create probes wich show a realtime monitor of the value of a wire, or you can create indicators on the wires. Probes are visble in front of the block diagram so that is useful for learning. It is helpful to create a VI in a step by step manner - adding probes and indicators as you proceed to make sure you are getting the results you want. In the VI I provided I created 3 array indicators, two intermediate arrays, and the final result. I would find it very difficult to compose VI's without this technique. Finally, in using these internet forums it is alway best to explain the overall goal of the programming task. You will receive much better advise this way. What is the use of this interleaving process? What will you do with the final array? Perhaps we could give you a better solution if we knew what task is to be achieved. In our experience what you asked for seems not useful. It looks like a small, insignificant and probably incorrect part of a larger problem. Mike Download File:post-48-1144503998.vi Quote Link to comment
Wolfram Posted April 10, 2006 Report Share Posted April 10, 2006 i have do some work like this ,please give me some advise Another small solution. Have fun Wolfram Download File:post-1013-1144705333.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.