LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview 2021 'Replace Array' Data Issues

Solved!
Go to solution

I apologize for the late response, I am not a full time researcher so I have been unable to address these issues prior in the week. Thank you for the sample code, that has been a help in cleaning up our program to help it run faster. However, the core issue we were looking to solve is still there, but perhaps I can explain it better now. Note, the functionality of the code doesn't differ from the VI I sent earlier, it has just been cleaned up under the advised parameters.

 

Problem Indices.PNG

 The issue that we still have has to do with the 'Replace Array Subset' subvi. As it currently is written, the program will provide out the necessary 2D DBL array with row indices of 0 to 100, or however many time points. I fully understand that, for the graphical interface, we can adust the XScale through a property node to display that data on indices that match what we want instead of having i indices. Our group doesn't want to just have the display be adjusted, we would like the data itself to be saved as having those indices (for our current set of data it would be 100 increments from -1 to 3, forgoing units for ease of use). So, what we were wondering is if it is at all possible to, either before the 'Replace Array Subset' or after, redefine the indices of the 2D DBL array to match our -1 to 3 range instead of going from 0 to 100 in 1 integer increments. We need this to be saved to the data specifically, so that we don't have to spend extra time and extra programs to manually adjust the indices as we take this data into other analysis programs.

We attempted to conduct the index change before the subvi, with the obvious result of crashing the program, so we were hoping that something existed to change the data as it is transported in a 2D DBL array.

0 Kudos
Message 11 of 12
(492 Views)
Solution
Accepted by topic author wesdeeg

No, you can't change the way array indices are defined.  The first element is always index 0, the last is always index N-1 (for a size N array).  Nothing new here, it works the same way in C and many other languages (though some adopt the convention of indexing from 1 to N).

 

What you *can* do is generate your own separate X array that scales the index range [0, N-1] to your desired range of [-1, 3].   Then save *that* along with your Y data.

 

If you like, you can apply the same kind of scaling on your visual display using property nodes of the graphs.  For a size N array, it'd look like this:

 

Kevin_Price_3-1633257833867.png

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 12 of 12
(474 Views)