Jump to content

Pink vs Brown (variable sized vs fixed sized cluster)


Recommended Posts

I was working with some vims. and looking for a way to check rather the data was pink or brown. if brown i can simply typecast. but if pink i need to pad the strings to a fixed size.

I didn't want to iterate the elements of the cluster to check for strings or arrays.

Link to comment

Okay I may have a solution, but I don't know if it will work in your use case or not.  If you wire a cluster to an Add, it will work if all elements in the cluster support the Add function individually.  So you could have a VIM that has a Type Specialized structure, and perform a type cast if all elements in the cluster support the Add.  Oddly enough in my test I used a Timestamp Constant, and that makes a pink wire, but supports the Add, and is a fixed size.  But I'm not sure I understand what you want done into the byte array.  If you are just trying to get a byte representation of a cluster, and you want to use a fixed string for those cluster elements, it probably would just be best to iterate over element in the cluster with while loop recursion.  What I think you what can still be done with a VIM, using the Type Cast in one type specialized case, and then if that fails, then to iterate over all elements.

  • Like 1
Link to comment

Actually the color distinction of a wire is not specifically between a fixed size cluster and variable sized cluster and if it can be typecasted or not. Aside from adding a fixed size cluster into another cluster there is also the case where you add a boolean into a cluster. Both result in a pink wire but are still fixed size and can still be typecasted.

I think the brown wire only indicates that the cluster only contains numeric scalars and can coerce into a similar cluster with the same number of numeric scalars even if their numeric type is not exactly the same. Not really a very useful distinction I believe but 35 years back LabVIEW (and most other programming languages) wasn't as strictly formalized in many aspects.

Edited by Rolf Kalbermatter
Link to comment
7 hours ago, Rolf Kalbermatter said:

Actually the color distinction of a wire is not specifically between a fixed size cluster and variable sized cluster and if it can be typecasted or not. Aside from adding a fixed size cluster into another cluster there is also the case where you add a boolean into a cluster. Both result in a pink wire but are still fixed size and can still be typecasted.

I think the brown wire only indicates that the cluster only contains numeric scalars and can coerce into a similar cluster with the same number of numeric scalars even if their numeric type is not exactly the same. Not really a very useful distinction I believe but 35 years back LabVIEW (and most other programming languages) wasn't as strictly formalized in many aspects.

Total thread derailment... Hands up who remembers the great error cluster colour change. Was it 2005?

Link to comment
3 hours ago, Rolf Kalbermatter said:

But it existed since around LabVIEW 6.1. You had to add a funkyErrorWire=True or something similar into LabVIEW.ini

funkyErrClustWire works even in LabVIEW 6.0 (6i).

https://labviewwiki.org/wiki/LabVIEW_configuration_file/Block_Diagram

2022-01-13_17-24-52.jpg.8c8b83d61a93a6f86494d23a95b341c5.jpg

Doesn't work in LV 5.0.

But! This token is still being read in modern LV versions. For example, this is from LV 2020.

2022-01-13_17-30-00.jpg.a6446c2cf656a24cf26cd5e1437c0db7.jpg

So, if you don't like that brown(ish), you can switch to pink classic. :)

Edited by dadreamer
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.