LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Typedef cluster from known folder path.

Hi Everyone,

 For my application  i have converted all my typedef clusters into varient. In some places i have to convert this varient into cluster for some kind of processing. In this situation i have to place all typedef cluster in the block diagram. If i add one more typedef i have to change this code. Is there is any way to read the cluster dynamically from the hard disk.

 

Thanks in advance.

Happy to Wire
0 Kudos
Message 1 of 4
(3,245 Views)

To convert variant into cluster, you use Variant to Data function. But in any case it needs a wire with specified type. Changing wire type is change of the source code, you can not change it on the fly. 

You can do a lot of things with variants only (show different controls to user, load, save data), but if you fix data type, this will be a different vi, it is not trivial to replace wire type in memory. 

 

0 Kudos
Message 2 of 4
(3,224 Views)

It is not quite clear what you are doing nor what you want to do.  Having a VI (or several) that illustrate some of this would really be helpful (make sure, if you do attach code, that you attach actual VIs or Controls, not static pictures of block diagrams or front panels).

 

Here are some questions:

  • Why have you converted all of your Typedef Clusters to Variants?  [I'm not even sure I know what this means -- I'm guessing that everywhere in your code that you Bundle By Name a Cluster that has an associated TypeDef, you immediately run the Cluster wire through To Variant.  The rationale for doing this escapes me -- I cannot envision a situation where this makes sense.
  • To convert (one of) your Variants back to its Cluster, why do you have to "place all of the Typedef Clusters on the Block Diagram"?  Why not just put the Typedef of the Cluster you want to convert?  [You need, of course, to know, in advance, what is contained in the Variant Wire, which you've sort of "hidden" by making it a Variant].
  • It is certainly true that if you change your program by adding a new TypeDef, you have to change your code whenever you need to deal with this TypeDef.  This is true whether or not you use Variants.

I had to deal with something similar recently.  I had an analysis routine for data generated by Version 2.0 of a program, which had a specific Data Format.  However, Version 2.1, 2.2, and 2.3 had slightly different formats (each had its own TypeDef for the data).  I handled this by using a Case Statement with the Version Number (as an Enumerated Type) as the selector -- the individual Cases were "Process 2.0 Data", "Process 2.1 Data", etc., that is, each sub-VI "knew" how to process its own data.

 

Could something similar work for you?

 

Bob Schor

 

 

0 Kudos
Message 3 of 4
(3,208 Views)

Hi Sankar,

 

I understand your Question, Did auto update of Typedef Helped you?

 

Regards

Santhosh Balaji Raveendran

0 Kudos
Message 4 of 4
(3,183 Views)