LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster + case help

Solved!
Go to solution

Hello,

 

I am trying to learn clusters and the unbundle by name function using a case structure. For some reason my output cluster's wire is broken and it says the error is incorrect data type, but I am multiplying by a scalar, I do not understand why the error is happening and what to do to fix it.

 

Also I have a problem with the case structure. So I want the case structure do something if it is false (As displayed). But, I don't want it to do anything if the case structure is true. How would I go about in wiring and setting up the block diagram for the true case structure?

 

I have attached pictures of my front panel and block diagram.

 

Hopefully I was clear in my question, if not just let me know!

 

I appreciate all help! thank you!

Download All
0 Kudos
Message 1 of 11
(3,536 Views)

You have to use "Bundle by Name".

0 Kudos
Message 2 of 11
(3,528 Views)

Think of clusters as a box, containing various things.

 

To take something out of the box, you have to use UNBUNDLE or UNBUNDLE BY NAME.  You've figured out that part.

 

To put something back into the box, you have to use BUNDLE or BUNDLE BY NAME.  Your diagram doesn't have that.

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 3 of 11
(3,522 Views)

Building on what others have said here, you appear to have a misunderstanding of what the unbundle is doing.  Going with what Coastal mentioned, you're taking something out of the box.  What you do with it has no impact on what's in the box itself.  It's no longer a part of the original cluster.  It's now its own double. 

 

Think this through on a conceptual level.  Your cluster has three items that could be doubles.  If you just plugged the individual double into the "output cluster," how would it know which of the three elements you wanted to update?  The names don't have to match.  The way you fix this problem, as others have mentioned, is to input a cluster of data rather than a double.  That way, the data types match.  The easiest way to do this is to use the Bundle by Name.  This will take your original cluster as an input.  Anything that you wire into the Bundle will update THAT value.  The remaining values will be untouched. 

 

I'm not sure why you're asking for case help.  You don't appear to have any issues with your case.

0 Kudos
Message 4 of 11
(3,490 Views)
Solution
Accepted by topic author kenypatel

Hello,

 

Maybe you got the true part of the case right by accident; we can't see what's there but as you didn't mention errors from it, we'll assume that you did get the syntax right.

 

You choose which of the cases to edit by setting the case needed at the top. The left arrow=previous, right arrow=next, down arrow=menu. The wiring on screen will change to show the wiring for the selected case.

 

So try selecting TRUE. The wiring you will see is what happens when the input is TRUE. As there is an output wire from the case, you should wire something to it, perhaps a wire straight across from the input, so you are doing nothing to the input, other than feeding it to the output. If you don't wire anything to the output, you will either pass that type's "default" value to the output, or get an error, depending on a LabVIEW option setting. The default value of a number is zero.

 

Rod

 

0 Kudos
Message 5 of 11
(3,448 Views)

Thank you all for your help! I think I understand how to fix my cluster problem.

 

However, my problem with the case statement is that I don't know at all how to wire it. I currently have nothing in it. I want the true case statement to do nothing. I literally just want an if false then this. If true then do nothing. 

 

I appreciate all the help you all have given me so far! It really helps

0 Kudos
Message 6 of 11
(3,431 Views)
Solution
Accepted by topic author kenypatel

I want the true case statement to do nothing. I literally just want an if false then this. If true then do nothing. 

 

Then put nothing into the TRUE case.  It really is just as simple as that.

 

Put something into the FALSE case.

 

Do note that *-IF-* you have something coming OUT of the FALSE case (an output from something inside the false case coming thru the case "wall", then you have to supply something for that wire in the TRUE case as well.

That can be just a default value, or a zero, empty string, whatever, but you have to supply a value.

 

But that's ONLY if that wire goes thru the "wall".

 

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 7 of 11
(3,425 Views)

I just tried to retry my cluster problem. I still cannot seem to get a handle on it. What I am doing is debundling by name and getting a number stored in a double. Then if the case is false I am taking the absolute value of the whole cluster. Then I am multiplying that cluster by .5 and sending that to an output cluster.

 

I do not see what is wrong. All I am doing is polymorphism and it seems the data types should agree. I'm just multiplying by a scalar. At least that is what I think

0 Kudos
Message 8 of 11
(3,408 Views)

I do not see what is wrong. 

 

you know, I do not see it either.

 

Perhaps if you posted your latest attempt...

 

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 9 of 11
(3,402 Views)

Ahhh I figured it out!! I just wired it wrong! The wire going inside the case structure to absolute value is coming from the unbundle double. I wanted it to come from cluster! 

 

Thank you all for your help!!!! Helped me tremendously

0 Kudos
Message 10 of 11
(3,400 Views)