06-27-2017 03:30 AM
Hi Guys,
I need a help with something might be silly but i can't make my head over it.
i initialized a 2D array with 10 rows and 16 columns. connected to Replaces array subset, and the new element that feed the RAS is coming from Spreadsheet String to Array (which read the real time data from VISA).
I need to split my 2D array to be 2 1D arrays, one for rows and the other for columns.
I'm using Arduino to collect my data from sensor sheet. however, in my code i insert two specific lines which is going to be the starter of each Row and Columns.
I need to detect number 2000 in the beginning and since i detect the 2000 i'll insert the data into 1D array of the rows for 10 times.
then i need to detect number 5000 and when it's true, i should insert my data into 1D array of the columns for 16 times.
I tried index array and reshape array, but still something missing from me.
I tried to compare my new element with the number 2000, then tried to index it in an array but i couldn't solve the idea that the comparison is Boolean and i'm dealing with arrays. so i had always broken arrows.
any idea could help me please.
please check the attached documents.
Solved! Go to Solution.
06-27-2017 03:45 AM
Hi N.,
like in all your other threads your "explanations" are rather "uncommon" (misleading/hard to understand)…
Why don't you show some before/after examples? What are your input data and how should the output data look like?
i initialized a 2D array with 10 rows and 16 columns. … I need to split my 2D array to be 2 1D arrays, one for rows and the other for columns.
You have an 2D array with 10×16 elements. Which of them should go to your "rows" 1D array and which ones to the "columns" array?
Which row/column to you want to select?
Usually you need to use IndexArray to read rows or columns from a 2D array!
I need to detect number 2000 in the beginning and since i detect the 2000 i'll insert the data into 1D array of the rows for 10 times.
IF first element in row == 2000 THEN append row to 1D array 10 times
then i need to detect number 5000 and when it's true, i should insert my data into 1D array of the columns for 16 times.
You need basically the same code as for the "2000" detection - I think I don't need to repeat that pseudocode…
06-27-2017 04:10 AM
Here's the snippet I created to read the txt file you provided in a previous thread. As you can see, there are a couple of minor (but probably vitally important) changes. Since I had some data, it was easier to see which way should be which 🙂
You should be able to use this in your VISA version to process the output. Be careful for the empty line, which will mess with the positioning (an alternative is to change the 10 to 11 in QR function, and do nothing when the remainder is 10 (similar to the varied wait case).
06-27-2017 05:10 AM
Gerd,
thanks for replying.
first of all, i'm not native English speaker. so excuse me for misleading.
simply i want to represent my data that i'm receiving from Arduino over the intensity graph, frame by frame.
however, the idea of the numbers 2000 and 5000 wasn't efficient.
but please check the output from placing my palm (hand) over this sheet / you have a pic of labview output and the data from Arduino serial monitor.
thank you.
06-27-2017 05:17 AM
hi Cbutcher,
that is totally true, and i discard the idea after i learned the hard way.
You can either remove the empty PrintLn() function call, or add a shift register with a numeric type (like U32) and just increment when the line isn't empty.
that is not an option cause i need to know exactly what happened in each individual sensor.
please check my reply on the post of Gerd, it represents my output data.
all what i need is represent my data similar to my real time input.
assuming i'm placing my hand, i just want to see something represent the hand 😞
thanks for your helping and advising all the time mate.
06-27-2017 05:44 AM
Hi N.,
your text file seems to contain blocks of 2D data, seperated by an empty line.
Each block seem to correspond to one "frame" you are talking about…
Read the text file, split at empty lines, convert each block of data ("frame") into a 2D array, display this 2D array in the intensity graph.
What exactly is your problem, when you try to follow those steps?
06-27-2017 05:51 AM
Hi Gerd,
that is exactly as you said.
and this is what i'm doing, but when it came to be displayed over the graph, it doesn't give me the shape of the data and the location.
assuming i placed my phone which is rectangular on the top left side of the sheet, it won't be displayed with shape and location.
you'll find something on the intensity graph as the previous attached picture in my earlier reply. but unable to detect that object (no correct position or shape).
that is simply what makes me frustrated. somehow the indexing in the graph is not correct , not quite sure mate.
Regards,
06-27-2017 05:56 AM
Gerd,
if my VI doesn't fit with the same idea you just mentioned, can you tell me how to correct it.
this is the only subvi with problem from my whole big VI.
the rest of my software working properly.
the attached picture is my original VI for this aspect.
06-27-2017 07:41 AM
First time I've tried to upload video so apologies if it's useless - the link is https://youtu.be/1P-e0kD25tA
Is this what you got, more or less? This is generated from the text file you uploaded.
06-27-2017 07:49 AM
that is awesome.
yes it's more or less the same, except it's keep shifting all the time.
I tried to read my uploaded data on this form, and more or less is the same.
on real time always keep shifting and not in the position, that's why i'm trying to figure out how to do it similar to your way, keep it in their position without the shift.
i'm so confused now
Thanks mate