LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array problems

Your code is just crawling with with weird, overly complicated code and a lot of type mismatches. I don't think there is any good reason to make that array EXT. DBL will be just fine. Also your queue is of the wrong type.

 

 

Here's a quick draft.

(It does not have all the features you need and probably has some problems. You need to adapt it further.)

 

Message 11 of 22
(923 Views)

So the problem I see with initializing the array to a certain size is that I have no way of knowing how many data points that the program will take ahead of time.  There may be 100, there may be 800, it all depends on what the tech running it wants, and he doesn't specify how many data points, just a place to stop.

0 Kudos
Message 12 of 22
(905 Views)

@LarsUlrich wrote:

So the problem I see with initializing the array to a certain size is that I have no way of knowing how many data points that the program will take ahead of time.  There may be 100, there may be 800, it all depends on what the tech running it wants, and he doesn't specify how many data points, just a place to stop.


If you have a resonable upper limit (e.g. 1000 or 10000), you can initialize with that. That's peanuts for a typical computer. It is still not clear how you want to build the array and how it should depend on the ring setting. Can you explain.

0 Kudos
Message 13 of 22
(891 Views)

@LarsUlrich wrote:

So the problem I see with initializing the array to a certain size is that I have no way of knowing how many data points that the program will take ahead of time.  There may be 100, there may be 800, it all depends on what the tech running it wants, and he doesn't specify how many data points, just a place to stop.


Altenbach is right.  I have one application that uses a 2D array with varying sizes.  I initialize it with 10,000 elements so I am sure not to exceed the limit.  But you need to know your limits and that will depend on the data you are collecting, how often, and for how long.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 14 of 22
(884 Views)

Ok, so I remembered how to do a change of base of log functions and am able to do some math to work out how many data points there are going to be (horray math!), but here is the problem:

If my start/stop frequency controls are outside of the consumer loop, they won't work.  The tech will have to abort the program, then type everything in, and then start it again so the values are there when the program starts initially.

However, the initialize arrays need to be outside/before the consumer loop in order to use the shift registers. 

 

The formula box takes the start/stop frequencies and tells me how big my array needs to be, and somehow needs to be wired to the array index.

 

I attached an image and the actual program itself (not the random number generated copy).

 

The point of the menu ring in the front is that in order to do this calibration, you need to run the LISN Sweep sub.vi 3 times and measure 3 seperate things.  The menu ring in the front indentifies which set of data the user is taking.  Now, each time the LISN Sweep sub.vi is run, you get 2 arrays: 1 array of frequencies and 1 array of data points.  Since I only need the frequencies 1 time (I don't need 3 sets of the same data) there is the case structure in there that only executes when the 1st option in the menu ring is selected.  In the end, my array columns will look like frequencies, data 1, data 2, data 3.

 

With the insert into array it works as it is (minus the unnesseccary formula) so long as I run the menu ring in order.

If I switch the insert into array with replace array subset will I have to initialize the array size first?

Download All
0 Kudos
Message 15 of 22
(868 Views)

... there is an extra array in there I forgot about, it is not supposed to be there, just a remnant of something I was fooling around with.  It is the one that is all the way at the bottom of the consumer loop... totally unnessesary and I meant to take it out.

0 Kudos
Message 16 of 22
(867 Views)

You have not defined how many elements you are using in the arrays.  You have two 2D arrays "initialized.", but with 0 elements.

You probably do not need a P/C archetecture for what you are doing.  You are only passing the ring control value to the consumer loop.  You could do this with a basic archetecture, but I would stick with it.  It's overkill for what you are doing, but will give you room to grow in the future.  This was just an observation.

Your order of operation may be confusing to the operators.  They must have the right side controls selected before the Measurement control is used.  The Insert into Array function will grow your array, the Replace Array Subset will not, but the array should be intialized first.

How are you handling your errors?  I would steer away for Automatic Error handling and use your own.

 

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 17 of 22
(854 Views)

MoReese, that is the problem (and my question):

The size of the initialized array is determined by that formula that is inside the consumer loop.  I am not sure how to get that to work properly, as I cannot wire the result to go outside of the consumer loop to initialize the arrays.

0 Kudos
Message 18 of 22
(849 Views)

Sorry, I misunderstood.  I will take another look.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 19 of 22
(846 Views)

You can use something like this.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 20 of 22
(840 Views)