12-13-2021 03:49 PM - edited 12-13-2021 03:50 PM
Hello everyone,
do u know how can I get access to each element of 2D array independly? I mean by that, I want to pick every number from row ([1] [2] [3]), and after this from next row, to use this as variables in my project. I always need to read whole row with 3 number inside, so it shouldnt be hard. I managed to save data into csv file with GerdW(user) help and he gave me hint to use 2D Array but every time I try to do this 2D Array is shown as indicator and there are no links to plug to variable. In internet I found only only info about 1D arrays...
Any help will be useful!
12-13-2021 04:11 PM - edited 12-13-2021 04:16 PM
Its hard for me to believe that I cant really find any information about picking very element of saved Array for further processing. I mean what is point of creating 2D data array if you cant access but just display... There must be a way.
12-13-2021 04:41 PM - edited 12-13-2021 04:48 PM
Sorry, your question is very confusing and maybe hints at poor understanding of LabVIEW and arrays. Did you do the training resources? LabVIEW does not really have "variables", so please also clarify what you mean. Please define all your other ambiguous terms such as "plug in", "access", etc.).
Your two independent code fragments operate in parallel on the same file. I am sure you should define an execution order. To append a new row to a file, you don't even need to read it.
Please explain exactly what you want to do:
To operate on all array elements one at a time in memory order, simply reshape to a 1D array with a size of the product of the 2D dimension sizes and autoindex on a FOR loop.
12-13-2021 04:50 PM
I will try to explain this on screenshot It will be easier I think.
12-13-2021 04:55 PM
@Krzysztof_Orzel wrote:
I will try to explain this on screenshot It will be easier I think.
No, that does not explain anything!
12-13-2021 04:58 PM - edited 12-13-2021 05:03 PM
This code is just prototype to implement this in main project. I just want to make it work... I want to pick every number from each row (there are n rows and always 3 collumns = 3 numbers) and do smth with it. My main project is about controlling robot with ni softmotion module. So this is algorithm.
1. Push button : Save 3 positions of robots axes into into csv. (axis position is expressed in degrees)
2. After You have enough robot movements read them and split so they can be wired to coresponding axises.
every push of button is 1 save and every push of another button is 1 read from previously loaded csv. Ofc Before u start reading data you need to import ALL robot movements.
12-13-2021 05:05 PM
Can we assume that all values are integers? (currently, they are!) If so, why are they orange and why do you inflate your file with all these meaningless zeroes and decimal delimiters?
This would read your file and display one rows at a time every .5 seconds until all rows are processed. You can easily substitute your timing and processing for the indicator.
I really think you should start with the basic tutorials!!!!
12-13-2021 05:13 PM - edited 12-13-2021 05:15 PM
Im sorry you cant understand me in a way I want you to.
The zeros are not meaningless. Zeros stand for robot homing so
Row1 : Homing, Values:0 degrees,0 degrees,0 degrees
Row2 : Move in axes, Values:10 degrees, 20 degrees, 20 degrees
Row3 : Move in axes, Values:20 degrees, 20 degrees, 20 degrees
Row4 : Move in axes, Values:10 degrees, 40 degrees, 20 degrees
Row5 : Homing, Values:0 degrees,0 degrees,0 degrees
I need to read every row and PICK every value from current row to wire this into ni soft motion function block.
I cant just display this, I need to wire this values.
12-13-2021 05:19 PM - edited 12-13-2021 05:19 PM
You are still only showing integers. I meant the decimal delimiter and anything behind it seems meaningless.
Anything that can be displayed in an indicator can also be processed further.
You really (really!!!!) need to start with the basic tutorials. Learn about the principles of dataflow. Learn about simple state machines, etc.
12-13-2021 05:39 PM
I have 3 function blocks
every row of array contains 3 values, first value is for first function block so the second and third, these values are wired to position.
The problem is I cant pick these values as values which FITS to this they are always presented as some kind of array...