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,494 Views)
Solution
Accepted by topic author 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,483 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,446 Views)

Thank you for the alternative.Smiley Happy

0 Kudos
Message 4 of 10
(6,443 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,438 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,433 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,426 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,418 Views)

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

0 Kudos
Message 9 of 10
(6,416 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,394 Views)