02-16-2022 03:17 AM
Hi Together,
I don't know if this is the right place, but one (maybe philosophical) question:
in one subVi of my program, I have several Cases for a specific proceeding:
in one Case I'm collecting data from an external device and store this in an double array
and in another Case I save this data in excel:
in all the other cases (!) I just have the lines for keeping the information
which is pretty awkward, as I have to place all the other stuff around this lines
for better readability and clear cases, which have only the relevant information I think about change all this to like to local variables:
good idea / bad Idea?
Solved! Go to Solution.
02-16-2022 03:41 AM - edited 02-16-2022 03:44 AM
Hi Wolf,
@WWolf78 wrote:
in all the other cases (!) I just have the lines for keeping the information
which is pretty awkward, as I have to place all the other stuff around this lines
for better readability and clear cases, which have only the relevant information I think about change all this to like to local variables:
good idea / bad Idea?
Definitely a very bad idea (IMHO)! (As I already told you here…)
Several comments.
02-16-2022 03:52 AM
Hi GerdW
I already do this, otherwise I'd went crazy connecting the bunch of lines...
I've done this for several other Informations as for the MHL and CL and another loop,
anyway this is additional work as to create the Cluster, name all the items, and create the respective bundle/unbundle operations
advantage is just one line walking through all cases
that's right.
It's anyhow laziness as I'd have to wire less items (and less distance),
BUT
if it is recommended / common practice (?) I'll do this
02-16-2022 04:08 AM
Hi Wolf,
@WWolf78 wrote:
if it is recommended / common practice (?) I'll do this
Tell me any programming IDE/language where data copies and unrestricted data access via locals/globals is "recommended practice"…
(I'm not talking about using variables in text-based programming: in LabVIEW the wire is the variable!)
02-16-2022 04:27 AM
hm, got it
but when it's neither good practice nor recommended, why is it even possible?
resp, when should you use this?
02-16-2022 04:35 AM
Hi Wolf,
@WWolf78 wrote:
why is it even possible?
Because there might be reasons to use locals/globals in LabVIEW.
(You can also use global variables in most text-based languages…)
@WWolf78 wrote:
when should you use this?
You could use locals to write/initialize values in a control.
You could use globals in a WORM (write once, read many times) approach.
But keep in mind:
02-21-2022 02:32 AM
@WWolf78 wrote:
Hi GerdW
- You can bundle related stuff (like your several arrays) into a cluster to reduce the number of wires/shift registers. Use a typedefined cluster and (Un)BundleByName…
I've done this for several other Informations as for the MHL and CL and another loop,
anyway this is additional work as to create the Cluster, name all the items, and create the respective bundle/unbundle operations
advantage is just one line walking through all cases
If you have some sort of Init-case you can bundle everything without a type def. Just remember that the unnamed bundle requires wires to have a name for you to see them later on if you use Unbundle by name (Unbundle shows all, and you can't hide stuff)