LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using motor position to make array

Hi everyone, 

 

I was wondering if it was possible to use the x,y position of two motors, one being x, another being y, to provide the dimensions for an array. So if x move it adds a row, and y moves in adds a column?

 

I don't really have any code for this right now, I was just wondering if it can be done.

 

Thanks all!

0 Kudos
Message 1 of 7
(2,887 Views)

Here is what I was thinking,

0 Kudos
Message 2 of 7
(2,879 Views)

You can always put another row or column onto an array.  But you should start with a 2-D array.  Right now you are initializing your shift register with a 1-D array which means you can't add another dimension on and is why you are getting broken wires.

 

Then the question is, what are you really trying to do when you add another row or column.  Do you want to just concatenate it to the last row or last column?  If sok then Build Array will work just fine in Concatenate Mode.  Do you ever want to put the new row or column into the middle of the array?  Then you need Insert Into Array and figure out how to determine which row or column it gets inserted in front of.

 

When you add an element as part of a new row or column, what do you want to do with the rest of the elements in that new row or column?  Should they all be the same, all zero, all NaN?

 

It looks like you need to study the Array Functions palette a bit more and possibly take som of the online LabVIEW tutorials to learn how to work with arrays.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 3 of 7
(2,866 Views)

Thank you! I'll make sure to initalize it with a 2D array. 

 

My goal is to make a new index at every new x,y position and give that new index a value that is being read from an insturment. It has me a bit confused as you can probably see.

0 Kudos
Message 4 of 7
(2,836 Views)
You just use the Build Array function. The new x,y pair is a 1D array that gets appended.
0 Kudos
Message 5 of 7
(2,833 Views)

I've been looking at some of the NI examples and I think I'm going about this the wrong way. I don't need to make an array from the motor movements. I just need to focus more on the data collection into an intesity chart. I can set the N value for the for loops to the the number of x and y movements that I need to make. I remade my code, but it still doesn't seem to work.

0 Kudos
Message 6 of 7
(2,802 Views)

Are trying to create a 3D plot using the x and y motor positions for your x- and y- axes, respectively? Then use another acquired data point as the z value?

Cody A.
0 Kudos
Message 7 of 7
(2,764 Views)