LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mutliplyng a 1D array

Solved!
Go to solution

I tried a few methods, and searched I just can't figure it out.

 

I'm trying to multiply an array by itself, and recieve the logical 2D array.

 

I tried a while loop and multplying each elemnt by a full row/colum then build array, doesn't work.

 

I tried a few others with initilize array and replace, shift register,  converting to matrix and multiplying etc.  just doesn't work.

 

any suggestions?

 

0 Kudos
Message 1 of 10
(3,596 Views)

Would this code do what you want?  Try it out.

 

 

Message Edited by jmcbee on 12-03-2008 11:30 AM
0 Kudos
Message 2 of 10
(3,592 Views)

Or even better...

 

 

Message Edited by jmcbee on 12-03-2008 11:34 AM
0 Kudos
Message 3 of 10
(3,590 Views)

Not really, if I have 1,2,3,4 and I'm multiplying it by itself (or rather it's transpose) I should get

 

1*1, 1*2, 1*3, 1*4

2*1, 2*2, 2*3, 2*4

3*1, 3*2, 3*3, 3*4

4*1, 4*2, 4*3, 4*4

0 Kudos
Message 4 of 10
(3,584 Views)
Solution
Accepted by topic author nihm

My fault.  My linear algebra is not what it used to be I guess.  Try this out...

 

 

Message Edited by jmcbee on 12-03-2008 11:46 AM
Message 5 of 10
(3,582 Views)

Thanks!!!

I didn't know you can disable the indexing in the for loop, that's why I tried the while loop, rebuilding etc.

 

I am new...

 

🙂

0 Kudos
Message 6 of 10
(3,562 Views)
Not a problem.  This forum is a great place to spend some time, you can really learn alot.  Keep asking questions as they come up!
0 Kudos
Message 7 of 10
(3,558 Views)

jmcbee wrote:


Well, the inner loop is not needed at all, so why clutter the diagram?

 

Also remember that we have the "outer product" in the "linear algebra" palette, most useful if you want a matrix datatype as result.

 

Here are a few variations:

Message Edited by altenbach on 12-03-2008 11:27 AM
Message 8 of 10
(3,553 Views)
As is usual Altenbach is correct, at the very least the nested loops are not necessary.  I am not familiar with the linear algebra palette but it looks like it would be of interest to you.
0 Kudos
Message 9 of 10
(3,546 Views)
Don't feel bad. Whenever I look at some of my old VIs, the code shrinks by at least 20% whenever I add new features. 😄
Message 10 of 10
(3,536 Views)