LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a sequenced 1D array to an n x n matrix array for raster image display

Hello,

I'm looking for some assistance with a Labview project & would really appreciate any advice, hints as I have run into a brick wall

     Idea: Convert an acquired 1D-array into a square (row /column, "n x n") matrix array....size of matrix will range from 64 to 1024, but typically will be 256

Requireed:

Separate & access successive AI matrix data lines as each For Loop iteration completes to allow the data to be displayed on screen while acquisition runs...like a TV!

 

Down the road, but worth mentioning is that  I will eventually need to convert the n x n matrix array to a Tab delimited ACSII text file to allow for further processing of the image. 

 

Attached/below is a picture & VI of the For loop/Timed loop VI that I'm using...the 1D array that needs conversion is from the "Mean PtByPt" VI, which if it worked would go to the "Array"outside the For loop.....I have no idea if this is a good method but my logic is to use the sequence of these loops to build the matrix array sequentially row by row.

 

I have tried what seems to be a million different combinations of loop tunnels (w & w/o auto indexing), as well as, shift registers, build array w/&w/o concatenate etc. but to no avail

 

In general I've had ~50% luck with this conversion but there is always one part missing

 

Also something strange with the timed loop - A warning keeps coming up that an "object is hidden" for both INPUT/OUPUT NODES....it doesn't stop the VI from executing but I don't know what the object is because I can't find it!!!

 

If you happen to be able to lend a hand I would GREATLY appreciate it.

best

SS
0 Kudos
Message 1 of 11
(4,993 Views)
Sorry here is the JPG and VI
thanks
SS
Download All
0 Kudos
Message 2 of 11
(4,985 Views)
I would preallocate the square array and then acquire into it by replacing array elements as you go. This is much more efficient in terms of memory management compared to building an array at a while loop boundary.
 
(It seems you only get one data point/iteration of the inner loop. You just need to calculate the indices according to your requirements)
 
The attached simple example shows one possibility on how to do this (LabVIEW 8.0). At the end, it converts the 2D array into a formatted table (tab seperated), just write that string to file.
 

Message Edited by altenbach on 01-04-2006 06:03 PM

Download All
Message 3 of 11
(4,988 Views)
hey altenbach,
 
thanks for the demo VI and help....I'm going to try it out now and I'll let you know how it goes.
 
Thanks again!!!!
 
best SS
0 Kudos
Message 4 of 11
(4,977 Views)
BAM You the MAN!!!!
 
Go it to work with a little trial and error.....Awesome......
two weeks with labview and almost all ready to go....SWEETSmiley Very Happy
 
thanks for your help....SUPER!!!!!!
 
best
SS 
0 Kudos
Message 5 of 11
(4,945 Views)
altenbach,
 
I do have a question though...I noticed that the loop time is now much slower. I'm running on 2.5GHz with 40Gb free. Is there a way to increase the loop time by allocating space/resources? Also, I looked at the output text file (used write to file) and it wasn't tab delimited. I have reviewed the help files and can't find where/what I'm supposed to add to do to get the tab delimiter in between the numbers? If you know I'd appreciate it.
 
best
SS
0 Kudos
Message 6 of 11
(4,937 Views)
You want the loop to exicute slower? Put a Wait function inside the loop.

If you want to write straight to a tab delimited text file, stick your array straight into the "Write to Spreedsheet File" function. 
Message 7 of 11
(4,933 Views)
Sorry for the confusion....I want the loop to run faster....
Prior to putting the intesity image on the front panel I was able to run consistently ~10ms periods but now with it in,  its very very slow (haven't clocked it but it has to be ~100x slower or more)....
I tried doing the write to spreadsheet......ohhhhhhhhh......just tried again and duh, I was wiring it to the string not the scalar array! THANKS works great!
  
 
0 Kudos
Message 8 of 11
(4,929 Views)
OK I found my mistake....I pulled the graph outside the loop and its much better!
 
 
0 Kudos
Message 9 of 11
(4,927 Views)

In your original question, you wanted to see the graph to built up. This will always be slower. Don't send massive data to the graph terminal unless really needed. Grap updates are relatively expensive.

If you move the terminal utside the inner loop, you update the graph only after each row (or colum) and if you place it completely outside, you only update the full graph.

Most ideally, you should change the behavior depending on the acquisition speed. If the speed is very slow, you want to see it point by point, if it is intermediate, you only want to see completed rows, and if it is fast, update only complete frames. At warp speed, you don't even want to update the graph until the acquisition has finished ;).

Attached is a slight modification of my example that only updates one row at a time. Modify as needed.

 

 

Message 10 of 11
(4,919 Views)