LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Read - build a table

Solved!
Go to solution

I wan to create table in labview similar to the attached file. for example, if (C1, C2)= (10,20) the value is 2 and for (10,30) it is 5. My visa read outputs a string in the form (10.0, 10.0), (10.0, 20.0)....(20.0,10.0), (20.0,20.0). and so on.  I want to split this into row and column similar to attached file. and then get a value from another device whose output I want to add in the table depending on the co-ordinates. How can I do it?

 

Any help will be appreciated. 

0 Kudos
Message 1 of 14
(3,655 Views)

Do you need to use interpolation or are there specific values (e.g. 10.01, 9.99, 10.02 or always 10.0?) You might be willing/able to round the values from the first system to get a subset of buckets/values (e.g. 10, 15, 20, or 10, 11, 12...).

 

You can then use a 3D array if you map values to indices (e.g. 10.0 = 0, 15.0 = 1, ... for X). This is more complicated if you later have another value, like 12.0 -> ? do you make this 3, or 4 (i.e. a new last value) or reshuffle previous values? 😕

 

You can use a Map if you have LabVIEW 2019, with the X,Y pair as a Key and the Z value as a Value. This allows insertion easily, but requires more effort to output to a Table (especially if you directly store rather than rounding before inserting).

 

Do you ever get repeated values? e.g. (10,20)=2, (10,30)=5, then (10,20)=3? If so, do you want an average value (2.5)? or latest value, or something else?


GCentral
Message 2 of 14
(3,651 Views)

thanks for your time.

 

the values C1/C2 -  10,20,30 can also be in decimals like 10.5,10.3 ,20.6 etc.. and I will not get any repeated value like  this (10,20)=2, (10,30)=5, (10,20)=3. all values will be unique.  I am using labVIEW 2019.

0 Kudos
Message 3 of 14
(3,630 Views)

@dpksmth wrote:

I am using labVIEW 2019.


Then I would be tempted to look at using a Map.

For each incoming value pair, where you have an (X,Y) pair and a Z value (so three values from two sources) you can use X,Y as the Key and Z as the value.

 

This will allow (at any time you want to update your table) you to autoindex the Map and use Unbundle to get the (X,Y) and (Z) values.

They will be sorted according to some hidden rules, but for strings it's basically alphabetical, for numbers they are ascending. If you use a cluster, I believe it will be the same as the order you get from the Sort 1D Array. So your key could be a string, or a cluster of two numbers, or a cluster of two strings, and then you can use those for your Table.


GCentral
Message 4 of 14
(3,621 Views)

See if you can adapt this, it might be close to what you're looking for:

 

3DTableViewer_Edited.png

This is of course just a demo and probably the inputs and so on will need to be adapted for your sensors/hardware, but it might get you pretty close.


GCentral
Message 5 of 14
(3,620 Views)

Thanks for your time and efforts. I really appreciate it. I have gone through this VI and also got some progress in my work but not yet what I want. One thing I wonder is my table only look like this. I have attached a image of my table.

0 Kudos
Message 6 of 14
(3,545 Views)

Hi dpksmth,

 

I'm glad it was helpful.

 

With regards to your image, you'll have to attach your updated VI for me to be able to comment!


GCentral
Message 7 of 14
(3,542 Views)

taking inspiration from your VI, i tried to implement something like this. I am attaching the VI and screenshot here. It is just a simple VI for convenience. The inputs here are similar that I will getting from my devices. 

Download All
0 Kudos
Message 8 of 14
(3,530 Views)

Hi dpk,

 

use shift registers to store values for next iteration(s)!

 

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 14
(3,524 Views)

thanks for your help.You have almost solved the problem but the values are  repeating. for example if you see the VI here, for (10,10) the value is 11 which is fine but fir (15,10) it gives the same 11,  while I am expecting it to be 33. 

 

thanks.

Download All
0 Kudos
Message 10 of 14
(3,517 Views)