07-01-2012 07:42 AM
I have a 1-D array which I want to manipulate.
I want to replace the n'th element to the nth + j element with zero's ... and repeat this replacement at integer multiples of n.
So for example if n = 5 and j = 2, starting with an array of 1's then after manipulation the array would look something like:
1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1, etc.
So n = 5 to n = 7, n = 10 to n = 12, n = 15 to n = 17 .... etc equals Zero.
I'm setting the value of n and j with controls on the front panel.
I'm coming from a Matlab backround and slowly getting into Labview.
Appreciate the help !
Solved! Go to Solution.
07-01-2012 08:02 AM
This is a very simple problem. What have you written so far? We can either give you a fish or teach you to fish.
07-01-2012 08:30 AM
Hey cool, I've have been fishing ; )
Absolutely agree simple problem, getting around how to implement in Labview is the fun bit !
I've tried 'insert into array.' The index can be set to n and the subsquent elements be set to zero.
Can look at the output and see it's replacing the first set.Have this done manually so to speak.
How to implement a for loop to replace multiple integer sets and make the lenght I'm replacing dynamic (the j in my example).
The 'insert to array' context help shows (from my understanding) you can insert an array at multiple points. When using it I only get one index insertion point option. Also the subset array one is inserting needs to be built to lenght (j - n).
It's the dynamic side of things I'm having difficulty with.
Perhaps this methodology I'm using is wrong ??
Thanks,
Joe
07-01-2012 08:36 AM - edited 07-01-2012 08:37 AM
perhaps you should consider going through some LabVIEW tutorials http://www.ni.com/academic/students/learnlabview/
it is no different solving this problem in LabVIEW as in any other programming language
the algorithm is what matters
and, oh, yeah, we want to see your attempt with a VI
07-01-2012 08:58 AM
This is what I have so-far ...
Making the "insert into array" dynamic in relation to multiples of "n" and making the "insert into array" variable lenght (j as in my example) is where I'm at
07-01-2012 09:00 AM
Image came out abit small so ...
07-01-2012 09:40 AM
First, that is not a VI; that is a graphics file.
Second, since your problem is that you don't know how to process the 1D array, why are you throwing all that extraneous stuff in your program?
Start with a simple VI with an array of constants and see if you are able to come up with the algorithm for processing that array of constants.
07-01-2012 04:46 PM - edited 07-01-2012 04:52 PM
Ok,
After many attempts to manipulate the arrays I couln't get it to work so I ended up using mathscript to do the job:
In terms of using the labview functions I got to the point where I can insert any array of size j at any location n. To insert the array of size j at multiple locations at integer multiples of "n" I'm still having difficulty with.
I really would appreciate some guidance at this point, I have the mathscript solution working and would really like to know the "labview solution".
Attached is the VI.
I have been fishing for the day ; )
07-01-2012 05:24 PM - edited 07-01-2012 06:14 PM
@Joe_Le wrote:
I really would appreciate some guidance at this point, I have the mathscript solution working and would really like to know the "labview solution".
As you will see, a LabVIEW solution will be significantly simpler. The most important part would be to learn about shift registers. These are one of the core tools. 😄
Here's a very rough 2 minute draft. Modify as needed. Of course you would substitute your real array and use array size to get the size. See how far you get. 😉
07-01-2012 05:28 PM
Much appreciated !!
I'm looking forward to trying it out !