LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix subtraction

Solved!
Go to solution

Hi, 

I am trying to do a subtraction with two matrices. Why does this refuse to work?2.jpg

Chuan

0 Kudos
Message 1 of 10
(6,498 Views)
Solution
Accepted by Dirichlet123

Looks like a bug. Works just fine with a 2D array instead of a matrix.

(As a workaround, Insert a "matrix to array" before, and an "array to matrix" at the end.)

Message 2 of 10
(6,487 Views)

The problem comes from the Feedback Node (I never did like them -- I prefer the "old-fashioned" For/While Loop with Shift Registers).  This "equivalent" code works just fine:

Matrix Subtraction.png

Bob Schor

Message 3 of 10
(6,450 Views)

Thank you for the alternative.Smiley Happy

0 Kudos
Message 4 of 10
(6,447 Views)

@Bob_Schor wrote:

The problem comes from the Feedback Node (I never did like them -- I prefer the "old-fashioned" For/While Loop with Shift Registers).  This "equivalent" code works just fine:


This code is not equivalent. The shift register will get initialized with every call while the feedback node gets only initialized on the first call. Big difference!

So the question is: What is the code actually supposed to do? How does it fit into the rest of the code?

0 Kudos
Message 5 of 10
(6,442 Views)

You are correct, as always, Altenbach.  I'd actually used a "Do Once" While Loop (which, I think, is equivalent), then (carelessly) converted it to a For Loop just to make sure it still ran.  My (stupid) mistake!

 

Bob "Oops" Schor

0 Kudos
Message 6 of 10
(6,437 Views)

To make the "shift register/single cycle loop" equivalent to the feedback node, you need to leave it uninitialized, then use a "first call?" primitive and a case or selector inside the loop to properly initialize. Singificantly more code, that's why I like the feedback node. 😄

0 Kudos
Message 7 of 10
(6,430 Views)

@altenbach wrote:

Do make the "shift register/single cycle loop" equivalent to the feedback node, you need to leave it uninitialized, then use a "first call?" primitive and a case or selector inside the loop to properly initialize. Singificantly more code, that's why I like the feedback node. 😄


Except, of course, that it doesn't work in this particular example with Matrices (it certainly could be a bug in implementing matrices, of course, but also a possible bug in implementing Feedback Nodes ...):smileywink:

0 Kudos
Message 8 of 10
(6,422 Views)

Yes, I made an entry in the monthly bug thread. Maybe we get a CAR#. 😄

0 Kudos
Message 9 of 10
(6,420 Views)

Thank you for being vigilant in providing feedback. This behavior is now reported in CAR 304169. You may reference future LabVIEW release documentation to track bug fixes by CAR number.

Message 10 of 10
(6,398 Views)