LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register is only bringing back one row of my matrix

Hi I am doing some matrix manipulations with boolean inputs.

I need the resulting matrix from one iteration to loop back the second iternation and be reused.

For this purpose I used a shift register however it is only transferring one row of the matrix.

The code attached has 3 indicators  result, array 2 and array.

Result is the matrix just before it enters the shift register, array 2 is the matrix at the end of the loop, while array is the matrix exiting the shift register in teh beginning of the loop.

Result and array 2 are fine as shown in teh screen shot while array only has 1 row, I have starred at it for a few hours and I don't know why?

 

 Please help,

 

Thank you!!

Mike

Download All
0 Kudos
Message 1 of 5
(3,266 Views)

You didn't include your subVI, so I cannot run, but if the image is your VI upon compeltetion, it makes perfect sense.  You initialize your feedback node to be empty when the loop starts.  Your interior for loop runs 2 times with the settings from your screen capture.  The first time, Array will either be empty, or it will be the last value of result, since you do not initialize that shift register.

 

At the end of the code execution in the loop, you are appending a single row to your feedback node, so you will have one row.  Result gets updated to this.

 

The second time through the loop, Array gets updated to be the result from the first iteration, so one row.  Then the code in the loop runs and appends a 2nd row to the feedback node and updates result to a 2 row array.

 

At this point, the interior for loop ends and updates array 2 to match result.  Array never gets updated again becuase the loop doesn't execute.  Remember the incoming shift register has the value of the outgoing shift register from the previous iteration, so array will always be one behind result and array 2.  If you changed Sources to 3, I would expect you have 2 rows in array and 3 in result and array 2.

Message 2 of 5
(3,246 Views)

Yes it worked just like you said. 

I don't quite understand why though.

However, if I just add one more source iteration my "mask" matrix gets an extra unwanted row which is expected. 

Is there a way that I can move the entire matrix across instead of appending a single row to my feed back node

 

At the end of the code execution in the loop, you are appending a single row to your feedback node, so you will have one row.

 

Although it is unclear now..that feed back matrix is a set of gain values varying from 000 to 111 and will be input into another subVI and then a DAQmx

these are currently being represented by the constant array matrix "input".

so it needs to have sources = rows and each detectors is three columns.

 

Is there anyway to loop that entire matrix or should I just make it a large program with the same subVI over and over again.

 

sorry if that was confusing.

 

I have attached the subVI and a screen shot more realistic input version will look like the boolean array going into teh white box is the gain matrix

 

Thank you for your help!

Mike

Download All
0 Kudos
Message 3 of 5
(3,234 Views)
To be clear, you are not using a matrix, but a 2-D array.  Please use the correct terminology as a matrix represents a different data type wire in LabVIEW.
0 Kudos
Message 4 of 5
(3,215 Views)
Noted, Thanks
0 Kudos
Message 5 of 5
(3,211 Views)