01-03-2010 01:25 AM
Hello 2 all !
By using the attached vi's, i'm trying to send and receive a 2d array over tcp/ip, but i get a "out of memory" error from LabView.
Where is the problem ?... I've adapted the examples provided by ni, but somewhere there seems to be a problem.
Thank you 4 your time !
P.S. I'm using LabView 8.5.1 on Windows XP SP2
Solved! Go to Solution.
01-03-2010 01:59 AM
01-03-2010 02:03 AM
Your transmit does not sent the number of bytes before the number of columns. So the datatypes don't match. Fix the Transmit VI in this way:
Ton
01-03-2010 04:32 AM
01-03-2010 12:40 PM - edited 01-03-2010 12:43 PM
Your code still is overly complicated and does unecessary expensive operations (such as formatting) and inflates the data to be transmitted while causing a dramatic loss in precision. Formatting also adds significant amounts of code on both ends for no benefit at all.
There is no need to format into a 2D array of strings just to scan it back to 2D DBL array at the other end.
First you lose about 2/3 of the DBL precision (at least 10 decimal digits out of 15 are dropped, leaving you with only 5 decimal digits!) while inflating the data to be transmitted by 36%. Formatting and scanning operations are expensive in terms of CPU! Why do all that work for nothing?
As you can see, you can flatten the 2D DBL array directly and unflatten it later in the same way. Now the data is bit-by-bit identical (lossless!) on the other end and you transmitted significantly fewer bytes as a bonus.
Also note that if you place a small "built array" inside the FOR loop, you don't need to transpose. Again, less code!
Maybe the image can illustrate what I was trying to say. 🙂