07-20-2020 02:28 PM
Hi
I have a 2D intensity chart in a for loop that appends data on the X axis after each loop. This is normal but i was wondering if it would be possible for data to be appended in the Y direction rather than X direction?
In the attached image i have three plots .. the plot at the top is a intensity graph that gets plotted via tunnel mode after the for loop ends...
I would like to have a intensity chart within the for loop to plot this graph per iteration so it builds the image.
The two figures below within the image are intensity charts within the for loop. One figure shows by plotting the data per loop the data gets appending in the X direction but i need it to be in the Y direction.
I found by transposing the intensity chart, it plots correctly by appending in the X direction by the image is rotated by 90 degrees is it possible to rotate the display by 90 degrees as it is getting plotted? or alternatively append data in the Y direction?
Thanks
Solved! Go to Solution.
07-20-2020 02:31 PM - edited 07-20-2020 02:32 PM
Hi zak,
@zak9001 wrote:
I have a 2D intensity chart in a for loop that appends data on the X axis after each loop. This is normal but i was wondering if it would be possible for data to be appended in the Y direction rather than X direction?
Use an intensity graph inside the loop with a predefined 2D array hold in a shift register.
With each iteration you just need to replace a row (or column) inside that array to get your display fill along the Y axis…
07-20-2020 02:56 PM
Hi GerdW
Thanks for you suggestion.
I tried your suggestion. please see the figure in the attachement.
I predefined a 2D array of zeros of a certain size within the loop with a intensity graph and used the replace subset array command to replace zeros per row as the loop iterates with a shift register but how do i hold the data per loop in the 2d array . at the moment it seems to overwrite the previous row back to zeros ...
07-21-2020 12:20 AM
Hi zak,
@zak9001 wrote:
I tried your suggestion. please see the figure in the attachement.
I predefined a 2D array of zeros of a certain size within the loop with a intensity graph and used the replace subset array command to replace zeros per row as the loop iterates with a shift register but how do i hold the data per loop in the 2d array . at the moment it seems to overwrite the previous row back to zeros ...
I repeat the suggestion from my previous message:
Use an intensity graph inside the loop with a predefined 2D array hold in a shift register.
I marked the part where you failed in following the suggestion…
This is basic LabVIEW knowledge: to keep values in a loop for the next iteration you should use shift registers!
07-21-2020 02:17 AM
While you are solving your problem, feel free to vote for this old idea. 😄
07-21-2020 04:50 AM
Thanks it was simpler than expected , see attachment for solution
07-21-2020 06:25 AM
Using a Build Array is certainly simple, but you will grow the array indefinitely. This will eventually overflow memory and crash your program.
You need to follow the recommendations of the others and pre-initialize the 2D buffer array and replace rows. Trim the buffered array before appending the new row of data to keep the size under control. In the case of appending, you would need to delete the first row of the buffer before appending the new row to the end.
This will keep the 2D buffer array to the maximum size and keep your image from becoming squashed over time. You'll also end up stretching your image when you have less than a full data set. This is the only way to keep your aspect ratio consistent.
07-21-2020 10:00 AM
Thanks for you suggestion , i updated my code.