LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display data of unknown length

Solved!
Go to solution

So, I have a program that outputs that reads data and outputs an array. And I want to display this data. So for now I know the maximum size of the array is 18. So i created 18 numeric indicators and gave the value of each array in each numeric indicator. If not all 18 are used, i.e if the output array size is less than 18 then i will disable and gray out the unused numeric indicators. But my boss told me, its 18 for now, in future it can 30 or 70 or 100 etc. So instead of using numeric indicators i need to display this array output nicely. I thought of converting into a 2d array with number of rows being 7. But then the problem is, if the array size is 18, then in the 2d array first column will have 7 values, second will have 7 values and third will also have 7 values, the 4 remaining values plus extra 3 values of just 0. I dont want those 3 values. So now Iam running out of ideas to neatly display those values. Does anyone know a good method for that. Thank you. 

0 Kudos
Message 1 of 7
(1,004 Views)
Solution
Accepted by topic author govindsankar

Hi govindsankar,

 


@govindsankar wrote:
But my boss told me, its 18 for now, in future it can 30 or 70 or 100 etc. So instead of using numeric indicators i need to display this array output nicely. I thought of converting into a 2d array with number of rows being 7. But then the problem is, if the array size is 18, then in the 2d array first column will have 7 values, second will have 7 values and third will also have 7 values, the 4 remaining values plus extra 3 values of just 0. I dont want those 3 values. So now Iam running out of ideas to neatly display those values. Does anyone know a good method for that.

Convert your array of numeric data to an array of string data: strings can be empty, numerics always have a value!

 

Then you can show your 2D array of strings (or a table or a multicolumn listbox/MCLB) with some empty elements…

(You can also set the number of visible array elements at runtime in each dimension. With listboxes you can use their scrollbars easily to allow for very large number of elements. For even larger amounts of data a graph might be suitable…)

 


@govindsankar wrote:

So i created 18 numeric indicators and gave the value of each array in each numeric indicator. If not all 18 are used, i.e if the output array size is less than 18 then i will disable and gray out the unused numeric indicators.


What a horrible idea…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(998 Views)

@GerdW wrote:

Hi govindsankar,

 


@govindsankar wrote:
But my boss told me, its 18 for now, in future it can 30 or 70 or 100 etc. So instead of using numeric indicators i need to display this array output nicely. I thought of converting into a 2d array with number of rows being 7. But then the problem is, if the array size is 18, then in the 2d array first column will have 7 values, second will have 7 values and third will also have 7 values, the 4 remaining values plus extra 3 values of just 0. I dont want those 3 values. So now Iam running out of ideas to neatly display those values. Does anyone know a good method for that.

Convert your array of numeric data to an array of string data: strings can be empty, numerics always have a value!

 

Then you can show your 2D array of strings (or a table or a multicolumn listbox/MCLB) with some empty elements…

(You can also set the number of visible array elements at runtime in each dimension. With listboxes you can use their scrollbars easily to allow for very large number of elements. For even larger amounts of data a graph might be suitable…)

 


@govindsankar wrote:

So i created 18 numeric indicators and gave the value of each array in each numeric indicator. If not all 18 are used, i.e if the output array size is less than 18 then i will disable and gray out the unused numeric indicators.


What a horrible idea…


To expand a bit on this suggestion:

Make sure this converted data is for display purposes only.  Don't re-convert it to do calculations.  Just thought I'd put that out there considering the concepts you (OP) are struggling with.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 7
(965 Views)

Decided to use multicolumn listbox

0 Kudos
Message 4 of 7
(960 Views)

If they're different lengths you can have an Array of Cluster with a 1D array in it.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 7
(343 Views)

@govindsankar wrote:

Decided to use multicolumn listbox


This is a mistake unless you need listbox functionality. A table is much easier to update, just use a wire, a listbox requires a property node.

0 Kudos
Message 6 of 7
(319 Views)

Typically these types of APIs allow you to read incrementally. So you call it in a loop until bytes returned is less than your buffer,numbytestoread, or you get a terminator. Don’t forget to store each buffer you read to recombine the data.

0 Kudos
Message 7 of 7
(314 Views)