LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

manipulating values into arrays and integrating this array into another (beginner)

Solved!
Go to solution

So the results end up looking like this.. I wasn't sure whether having the results appear in this format is preferable?

 

Footballbag_0-1628512510490.png

 

0 Kudos
Message 21 of 34
(744 Views)

Hi Bag,

 


@Footballbag wrote:

So the results end up looking like this.. I wasn't sure whether having the results appear in this format is preferable?


So when you don't know if that data format is preferred or not, then how should we know about that?

 

Why is there a While loop in your last VI when you know the number of iterations before the loop? Use a FOR loop in this case!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 22 of 34
(741 Views)

Sorry, I'm confusing matters. I know the data format with the 5 columns is preferred for me for post-processing. I wasn't sure whether in terms of memory allocation or CPU usage I had vaguely heard it's better to produce results in row's and then transpose (I'm not being clear here because I lack that understanding). Nonetheless I want the array to be formatted with 5 columns and 10 rows for each of the 8 rounds of measurements.

0 Kudos
Message 23 of 34
(736 Views)

I was using the iterator to shut the pump off after the loop has completed its final iteration. I suppose I can do it with a for loop also, though it doesn't seem like it makes much difference. I suppose its an unnecessary complication.

0 Kudos
Message 24 of 34
(735 Views)

Thanks for the pointers, GerdW.

I hope that I am making sense in telling you what I am aiming for.

 

Kind regards,

Callum

0 Kudos
Message 25 of 34
(728 Views)

We cannot tell what output arrangement is "preferable". You should ask the end users and maybe inspect the requirements document.

 

You are still way overcomplicating things.

 

  1. As has been said, the outer loop needs to be a FOR loop.
  2. There is no reason to have a gigantic three-frame flat sequence structure just to cause a 5s delay before the inner code executes.
  3. Why is there almost no error handling?
  4. Why are there controls in the inner loops? Unless the user is allowed to randomly change these settings during the run, all controls belong on the toplevel diagram. If these controls are inside, the compiler needs to assume that they can change at any time, making the code less efficient. If controls can be treated as constant during the run, many more things can be optimized.
  5. The "stop IPC" function belongs after the outer loop. No need for the case structure.
  6. etc. etc.

 

You really should rewrite all this as a simple state machine with a toplevel while loop. Setting all control in edit mode followed by the run button in the tool bar is unprofessional. A end users should never be exposed to edit mode!

 

I would also recommend to clean up the front panel. A bewildering jumble of controls and indicators scattered randomly all over the panel is not user friendly.

Message 26 of 34
(715 Views)

We cannot tell what output arrangement is "preferable". You should ask the end users and maybe inspect the requirements document.

 

Sorry, I mentioned after I confused things, I want the array to be formatted like this:

 

pump % max speed  |  S11 mag  |  S11 phase  |  S21 mag  |  S21 phase  |

 

  1. Okay, I'll change that.
  2. Okay, a state machine would be more appropriate I would imagine.
  3. I'm not sure what that would look like, it looks like I haven't got access to the online training from NI for LabVIEW. I'm not sure whether the documentation will suffice?
  4. The controls can be treated as constants apart from the number of sweep points, the CW frequency, the S-parameter types, and the display format.
  5. I see, I could just pass to that case in a state machine as the final event I guess?
  6. etc. etc.
The end user is my PhD supervisor who has a little experience with LabVIEW but I suppose that's good practice.
I'll do that, I had copied them manually across to a new VI, but its not good for getting help.
0 Kudos
Message 27 of 34
(705 Views)

Could you see the solution to my current situation of overwriting the column of values completely as in the below image:

 

Footballbag_0-1628521234721.png

 

I've attached the VI with a slightly cleaned up front panel for reference.

 

Thanks for the help again.

 

Callum

 

0 Kudos
Message 28 of 34
(702 Views)

@Footballbag wrote:

Could you see the solution to my current situation of overwriting the column of values completely as in the below image:


If the data ends up in the wrong place, it is obviously caused by the way you are calculating the indices for the replacement operations. You definitely need to define the problem better because you don't say what it is. Do you want to overwrite or not overwrite? If you don't like how the data is arranged in the picture, you also need to show how you want it arranged.

 

How big are the arrays coming out of the "Read data" VI?

 

Message 29 of 34
(695 Views)
Solution
Accepted by Footballbag

The problem is that you cannot replace a 1D array in a 2D array and specify both indices. Thus you always replace the entire column.

 

In order to specify row and column indices, you either need to wire a scalar or a 2D array. In your case you would create a Mx1 2D array (And transpose if you want a column array) and replace at the desired locations. Here's a quick draft to demonstrate. I had to take out all your IO, but is should be easy to adapt to your problem.

 

Modify as needed.

 

altenbach_0-1628530503349.png

 

Message 30 of 34
(690 Views)