From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Datalabels in clusters

I'm trying to write a .vi for saving some data. All the data are transported
through several different clusters and I would like to read out the labels
of the components in the cluster to use when saving them to a .ini file.
The function cluster to array only gives me the data and then it is a bit
hard to keep track of what variable all the numbers rely are connected
to. Have tried the function flatten to string also but it does not seam
to
be useful eider. Any one knows some solution to the problem?

Thanks in advance.
0 Kudos
Message 1 of 6
(3,268 Views)
Hi

If I am understanding your requirement, I have almost finished the solution.

The intention of what I am doing is automaticly to write the information in
a cluster (or any other LV variable) to a (ini/configuration) file. To do
this I have decoded all LV variables structures and by using the new LV
configuration File functions writing them to a file (also a string equal to
the file is available).

Running the 'Variables to configfile.vi' will show you how it works. So far
only one value is added to the file, but soon i will include decoding of all
variable types. My intention is also to read back the file and put the
information into complex LV structures.

ONLY TESTED ON LV5.1, decoding og LVstructures may fail if NI cahnges the
structure format.

Contact me if anyo
ne wants to test the VIs.

Hans Øhra
hans.ohra@ffi.no
Norway

Jan Larsson skrev i meldingen <38464289@newsgroups.ni.com>...
>
>I'm trying to write a .vi for saving some data. All the data are
transported
>through several different clusters and I would like to read out the labels
>of the components in the cluster to use when saving them to a .ini file.
>The function cluster to array only gives me the data and then it is a bit
> hard to keep track of what variable all the numbers rely are connected
> to. Have tried the function flatten to string also but it does not seam
>to
> be useful eider. Any one knows some solution to the problem?
>
>Thanks in advance.
0 Kudos
Message 2 of 6
(3,268 Views)
There is a structure decoder for LV4

ftp://ftp.pica.army.mil/pub/labview/vi/lv4/lv-structure_decoder.llb

that does what you are trying to do for LV5.1.

So much work became obsolete the day LV5 was released. So my advice is not
to spent too much time on VIs that depends so strongly on the LV data
structure, which is 100% guaranteed to change in the next version.

If you really want to you can try to upgrade the LV4 structure decoder to
LV5.
Maybe a good shorcut would be the 4.x to/from 5.1 data format converter
found in the LabVIEW
support files:
"vi.lib\utility\victl.llb\Convert Type Descriptor and Flat Data.vi"

Regards

Jean-Pierre Drolet
0 Kudos
Message 4 of 6
(3,268 Views)
Yes, I know of the structure decoder for LV4, and I know I run into trouble
with new versions of LV, but it is in fact very easy to decode the LV
structures (LV4 version was unecessary complicated).

So why am I doing this?? Since I am building large signal processing
applications with LV, there is a lot of work to write the code for storing
configuration files when a large number of variables are involved. The
appliaction uses global variables (again I am aware of the discussions of
were to use globals or not) to store sttings for a signal processing block
(often 2- 10 variables) and in the application I now have some 20 different
signal processing blocks. I use a cluster to hold the variables for each
block, and with the new VI I just pass the vi recerence of the signal
processing module ( module often uses 2 - 5 blocks, and therefore 2 - 5
clusters) and all this information is written to a configuration file. I
tell you that I save a lot of work writing new modules now. From this
decoding VI I also get a string that looks like the configuration file, and
this is passed to WORD as text together with the results from the signal
processing. In this way I get store the actuall settings used during that
particular analysis. ....and again I save the time to write the code to
store each parameter to WORD. You shold try it.

May last message two days ago, I said that only U32 was decoded, one day
later I can write and read all LV variables including complex numbers and
numbers with units to and from configuration files. (Arrays are not suported
sice i do not like them in config files). Since I have used the underlying
configuration file functions in LV51, it is fully copatible with those
functions.

I think that decoding of these structures should be implemented in LV so we
dont have to bother with changing internal LV structures!!!!

See attachment

Hans ?hra



Jean-Pierre Drolet skrev i meldingen <384816a7@newsgroups.ni.com>...
>There is a structure decoder for LV4
>
>ftp://ftp.pica.army.mil/pub/labview/vi/lv4/lv-structure_decoder.llb
>
>that does what you are trying to do for LV5.1.
>
>So much work became obsolete the day LV5 was released. So my advice is not
>to spent too much time on VIs that depends so strongly on the LV data
>structure, which is 100% guaranteed to change in the next version.
>
>If you really want to you can try to upgrade the LV4 structure decoder to
>LV5.
>Maybe a good shorcut would be the 4.x to/from 5.1 data format converter
>found in the LabVIEW
>support files:
>"vi.lib\utility\victl.llb\Convert Type Descriptor and Flat Data.vi"
>
>Regards
>
>Jean-Pierre Drolet
>
>



[Attachment Outer Cluster.doc, see below]
0 Kudos
Message 5 of 6
(3,268 Views)
Hans Øhra a écrit dans le message :
82dm8n$k4f$1@news.ffi.no...


> I think that decoding of these structures should be implemented in LV so
we
> dont have to bother with changing internal LV structures!!!!

I fully agree!

Well, I think that if you restrict your decoding to clusters of simple
datatypes, it worth the trouble...

Continue the good work.

Regards,

Jean-Pierre Drolet
0 Kudos
Message 6 of 6
(3,268 Views)
Why don't you try the function unbundle by name and you can seee the
data's names.

Paul



In article <38464289@newsgroups.ni.com>,
"Jan Larsson" wrote:
>
> I'm trying to write a .vi for saving some data. All the data are
transported
> through several different clusters and I would like to read out the
labels
> of the components in the cluster to use when saving them to a .ini
file.
> The function cluster to array only gives me the data and then it is a
bit
> hard to keep track of what variable all the numbers rely are
connected
> to. Have tried the function flatten to string also but it does not
seam
> to
> be useful eider. Any one knows some solution to the problem?
>
> Thanks in advance.
>


Sent via Deja.com http://www.deja.com/
Before you buy.

0 Kudos
Message 3 of 6
(3,268 Views)