11-29-2019 06:38 AM
Hello everyone,
I am generating an array via shift register. My purpose is to add another array(exactly same size with the first one) to this and create a 2d array.
Like
Minimum Val ; Data val
0 1
0 1
When i press the record button i write the data so spreadsheet and i erase the first array. How can i erase the last 2d array after each time i pressed record. I dont know why it saves data on that 2d array. How can i erase that array completely. My purpose is, to write data between the last button press and the one before that.
Thank you so much!
Solved! Go to Solution.
11-29-2019 07:04 AM
Hi dogu,
@doguhanpala wrote:
When i press the record button i write the data so spreadsheet and i erase the first array. How can i erase the last 2d array after each time i pressed record. I dont know why it saves data on that 2d array. How can i erase that array completely. My purpose is, to write data between the last button press and the one before that.
You really need to learn the LabVIEW basics: now you stumble upon the initialisation of your shift registers!
Simplified your VI:
Why do you need a FOR loop to create an array of zeros?
Why do you need a sequence structure?
Why do you prepend new data to your arrays? Usually data gets appended…
The Select node makes it easier to read your code…
11-29-2019 11:11 AM - edited 11-29-2019 11:13 AM
Here's how it could look like:
12-01-2019 11:48 PM
Hello GerdW,
Thank you so much for your input. About your questions,
"Why do you need a FOR loop to create an array of zeros?"
It is a part of my bigger program. I cannot share it all due to confidentiality so i share a similar program. My purpose is to create a file like this.
min val, data val(which i read) max val
5 10 15
5 12 15
I dont know the size of my array. The user might get 100 or 1000000 data. Minimum value is a constant so i get size of my array and create minimum value array exactly same size. Then i write to the document.
"Why do you need a sequence structure?"
The real program does more than the version from here. It goes like this. Write headers and stuff, get the data, add the min max val arrays, write the document,test the values,write the result to the document. I use sequence structure there. Since it is part of the program i shared it. I assumed it would affect the answers.
"Why do you prepend new data to your arrays? Usually data gets appended…"
purpose is the write document like this
min val, data val(which i read) max val
5 10 15
5 12 15
"The Select node makes it easier to read your code…"
I did not know that block. I will use it. It is a bit difficult and ugly to use case structures even for really simple choices. Thank you for this information.
My algorithm goes like this.
User pressed a button and loop started. The data comes from oscilloscope and it is written to an array. When user press the record button, the program gets the data, addes min max and writes to the document. This works fine. When user presses play button again and records the data again, i get the 0's
After each record i need to clean the arrays.
Thank you so much for your input and help!