03-26-2020 01:45 AM
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.
Solved! Go to Solution.
03-26-2020 02:10 AM
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?
03-26-2020 03:31 AM
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.
03-26-2020 04:27 AM
@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.
03-26-2020 04:49 AM - edited 03-26-2020 05:35 AM
03-29-2020 11:05 PM
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.
03-29-2020 11:15 PM
03-30-2020 01:56 AM
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.
03-30-2020 02:15 AM
03-30-2020 03:35 AM
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.