LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner issue with saving results from loop into array

Solved!
Go to solution

Hi there,

 

I'm running a program that is attempting to sync up a peristaltic pump with a VNA. At the moment I have two for loops for the VNA: one to select the S-parameter measure to take and nested in that, one to select magnitude and phase measures. The inner loop at the moment outputs a 2d array of both magnitude and phase for the current S-parameter using auto-indexing. I want to save this 2d array (2 columns) and then loop over the next S-parameter. I have looked to change to using a shift register as I understand this may be a better approach. I've attached the VI.

 

I'm sure there are better ways to write the overall VI also, so any pointers would be appreciated, Thanks.

0 Kudos
Message 1 of 4
(1,183 Views)

I've cleaned up the VI slightly as there were some overlapping wires and the front panel wasn't clear.

 

Attached is an image of one round of data output so far, I want that to appear as magnitude and phase for each s-param measurement in columns.

Download All
0 Kudos
Message 2 of 4
(1,167 Views)

No, that program is quite meaningless. What's the purpose of "Data 4" since its value is never used? All your "Data" control ever gets is the result from the last iteration of the outer loop, dropping everything that happened in earlier iterations.

 

Can you reduce the problem to a simple VI that does not require any hardware? Define all typical input values and explain what you expect to see as output.

 

Also explain all acronyms. For example VNA can have many meanings.

Message 3 of 4
(1,155 Views)
Solution
Accepted by topic author Footballbag

@Footballbag wrote:

Attached is an image of one round of data output so far, I want that to appear as magnitude and phase for each s-param measurement in columns.


Typically we just append rows to an initially empty array as follows.

 

altenbach_0-1627657418481.png

 

Hard to tell exactly what you want, but appending columns is typically inefficient because of a constant need of copying data in memory. You can always transpose at the end.

 

Message 4 of 4
(1,147 Views)