Hello, friends.
Today I will tell you how to create data in Lab view and how to store that data into Excel file.
So for that purpose, I just create first data.
So I'm just using a for loop.
As you see over here, I am having a for loop.
And over here we just create a control.
And the name of this data, Numeric is it is the data history.
Or you can say data memory,
because how many
data you require in this case you just put over here.
Let's say I want ten times.
So I just put ten over here.
If you require 100 data, then basically the number of data you require you should put over here.
So right now, this is my data memory.
And over here, this is my iteration.
It will start from zero two up to N minus one.
And N is given by this data memory.
So let's I have a random number over here.
And this random number will create values from 0 to 1.
And I just take another number.
Random number.
Let's say this random number will generate the temperature between 0 to 100 degrees Celsius, let's
say.
And I just copy this function, this random number.
Because in this case, I want to generate all type of data and I want to put that full type of data
inside a Excel sheet.
So the range of this second random number is from
20 to 60, let's say.
So I just add on these using build array function.
So let's first data is my serial number that is 0123456789 up to date to me.
Second is my random number that will generate 0 to 1.
Third is my best one.
Let's say this is my temperature data.
And the fourth one is let's say it is the humidity.
Right.
Okay.
And at the edge, I got all these data collected because auto indexing is right now on.
So to write this data into Excel sheet, I just go to file input, output, write delimited spreadsheet.
Just you have to connect as you see over here.
And when I put Control Edge over here, I just feed to the data, two dimensional data to it.
And over here it require a file path.
Just create a constant over here because I have to give file path to to this function.
And I'm just using comma delimited file.
So just put comma over here.
So it will create your data into Excel file.
So just create an Excel sheet over here.
So first I just create an Excel sheet.
You have to just right click new micro Excel worksheet.
And I just name it November.
Okay, so this is Excel sheet.
I have to create a CSV file from it.
So to create a CSV file, I just save it.
Save as on my desktop again.
And the name is again November.
And over here you have to use comma delimited CSV file.
Okay.
Just save it.
Yes.
Just close.
See?
Okay.
So as you see over here, I got a CSV file.
Just delete this Excel sheet right now in the browser or here in the part, you just click on Browse
for part.
Just select your file in the next of
This is my number CSV file.
Save it.
Control you to minimize the path as you see over here.
This is my temperature data or here.
This is my humidity data.
And this random number will create some values from 0 to 1.
And this is my iteration.
From zero to and minus one and NW is given by data empty.
So let's check.
So let's I put ten inside this and when I hit on run button data generated and it will be updated into
the excel file that is CSV number csv.
As you see when I hit on button, I got this data.
This is my iteration.
Second is my random number data.
Third one is my humidity data, not temperature data, because it is from 0 to 100.
As you see, I got 85 over here.
And this data inside this data, we got the data between 20 to 60 only.
So this is how you can feed or log your data inside Excel sheet.
So let's check another important features of this.
So when I again hit on Run button, it will create some error because right now this CSV file or you
can say this Excel sheet is open, you have to close this and just also check this.
The ninth data for the humidity is 28.
When I again hit on one button, it will again update it.
So close this, stop this.
So when I again hit homerun button data is generated right now let's check what happened to the last
data as you see over here, data is updated.
So this is how you can generate in this case.
Right now, I'm not appending the data.
If you want to store your data, let's say right now, I again hit on the button again, it will create
error because Excel is open in this case.
Let's say if you hit button, data is created again, data is overwriting again and again in your file.
If you want to store your previous data.
Also just append to file create constant over here.
It is false in this condition.
Just make it true when it is true when you hit on run button, let's say first, second, third.
Right now multiple data stored into your Excel file.
As you see over here, the data is zero one, two, three, four, up to nine again, zero one, two,
three, four, up to nine again.
So this is how you can store your previous day data.
Let's say I make it for the 24 hours.
So I just put over here 24.
So according to me, in a day, there are 24 hours and one hour this loop.
When this loop runs, once time, it is equal to, let's say, one hour.
So according to this, if you want to store the data day by day, you can use this program.
And over here, if you want to put some delay, also delay, make it to show you the data what is going
on over here.
But I just delayed this delay.
So when you hit on again run button right now it make error because it is open.
So when I hit on the button again, let's check what happened to the data.
So as you see, our previous data is from 0 to 9 again, 029 and in the last we have from 0 to 23.
So this is how you can log your data inside the Excel sheet.
This is all about how you can log data into Excel sheet.
Thank you.