LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Matrix

Hi, 

I'm new on here and have been using LabVIEW for a week now. I made a simple Matrix a (2x1) - (2x2) x (2x1) and it spits out an answer in a = (2x1)

2 of them are controls and 2 are indicators and it works pretty well. I'll upload the file.

 

What I'm trying to do next is I want to be able to  use the same matrix but this time around I would like the user to be able to enter the values of any 3 that they might have of the above matrices and it should spit out the value of the last remaining matrix. 

I also create an executable file at the end.

 

Any help would be greatly appreciated!!!

Thanks.

 

 

0 Kudos
Message 1 of 6
(3,175 Views)

Welcome!

 

This is quite a nice task... My question would be: what is your metric for "the last remaining Matrix"? One possibility is of course, the last one that is still zero. In which case you could use a case structure, that checks which matrices are still 0, i.e. first one both zero -> case 1, second one both zero -> case 2 and so on.

Another one is to track which were the two matrices, that have been altered, and calculate the third. For this you'd have to look into event structures and shift registers for storing the information.

 

As for your code so far: you should consider cleaning up a bit. Even [Ctrl] + [U] helped a lot and it rarely does.

Also, for your task it might be quite helpful to look into arrays(matrices) and clusters.



Remember Cunningham's Law
Message 2 of 6
(3,146 Views)

Thanks for your reply.

 

Well out of the 4 matrices any one of them would have unknown values that a user would be trying to find. Not necessarily a zero. Like I said I have been using it for a week now and I'll look into some of your suggestions, the ctrl U short cut pointer was a good one, thanks for that.

 

If you think of a simpler way to implement this, let me know.

 

Thank You.

 

 

 

0 Kudos
Message 3 of 6
(3,128 Views)

First, work out (with pencil and paper) how you would solve this problem.  You might find that, from a "math" point of view, it is not trivial.  [Actually, it's not that bad, but it is definitely not what you described in your Original Post -- the 2x2 Matrix is really a one-parameter 2D rotation ...].

 

Now design how you'd like to frame the problem.  Think about the User Interface (a.k.a. Front Panel) -- how do you want to formulate things?  What things are "constant", what are "variable", how do you want to designate "known" and "unknown"?

 

Design first, code later.

 

Bob Schor

Message 4 of 6
(3,121 Views)

@Bob_Schor wrote:

how do you want to designate "known" and "unknown"?

 

 


This!

If you say I want to calculate the unknowns, how is your program supposed to know that the field containing a 3 is the unknown? So, what I mentioned above: zeroes or last unchanged make sense.

You could also add 3 buttons that say, calculate <this> matrix and then trigger a different algorithm for each button. At this point, you will be tempted, maybe even required to use local variables, so let me say this: Do not overuse local variables! At most you can define each field as a control and create a variable (as in "one" each) to write back into it.

 

Also to emphasize what I said earlier: Look into arrays (and matrices). That way you don't have to calculate everything by hand.



Remember Cunningham's Law
Message 5 of 6
(3,110 Views)

Thanks. I'll look into that, this might not be as simple as I originally thought it would be to make in LabVIEW.

 

 

0 Kudos
Message 6 of 6
(3,092 Views)