From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

I have a self modifying typedef that breaks my code

Solved!
Go to solution
Solution
Accepted by topic author dacad

This is where the old Cluster to array helps a lot.  Type def the cluster of 4 elements and drive your loops with whatsist type cluster to array of exactly 4 elements (or however many whatsits are in the cluster)


"Should be" isn't "Is" -Jay
Message 11 of 17
(581 Views)

There you go, DACAD - if your logic requires four and only four items, then why not make your TypeDef  a cluster of four items?

 

If you absolutely need an array, then use CLUSTER to ARRAY, otherwise just deal with the cluster directly.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 17
(574 Views)

This is a very old legacy set of vi's and typdef so I had never given any though on changing the methology of it but revising to a cluster would essentially error proof it.  It would also let meuse the captions on each item of the cluster to ID each of the four controls as needed.

 

I little work to go throough and change all that but if this thing boinks again, I would have to do that anyway.

 

Yea, think I will go ahead and run that path.

 

Thanks for all the input.

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 13 of 17
(569 Views)

I've never felt a compelling need to typedef an array because a typedef'd array doesn't really mean anything to me.  I very often drop typdef'd stuff inside the array, though.

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.
Message 14 of 17
(560 Views)

I've never felt a compelling need to typedef an array because a typedef'd array doesn't really mean anything to me. 

 

I have TypeDef'ed them for cosmetic purposes.  If a particular array appears in a variety of places and you want them all to be 1069 x 154 pixels, well, it will help you enforce that.  Beyond that, though, I agree with you: I always typedef the ENUM itself, and then have an array of them somewhere.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 15 of 17
(549 Views)

Just a follow up.  I converted the typedef to a cluster of four elements (enums) and applied and saved it.  I expected to have several broken vi's due to this.  To my surprise, I did not. The actual instances of the typdef updated as expected but all the constants that were originally based on the typedef also updated. This I was not expecting. The only caveat was that the constan values all reverted back to default values and I had to repair that but I was surprised it didn't cause more havoc.

 

I will probably never know exactly why the orignal typedef added elements to the array but going forward, I will avoid that method and use the cluster method instead.

 

 

 

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 16 of 17
(515 Views)

Wow, you experienced all the highs and lows of typedefs all at once!  I think the typdef reverting to default was fixed recently because I confirmed it happened in 2009, but I did the exact same thing in LV 2014 and the constants did NOT revert!

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 17 of 17
(511 Views)