LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Facing problem in saving data without overlapping in for loop

Solved!
Go to solution

Hi,

I am facing problem in writting data withou overlapping if i run outer loop for 2 or more times and in inner for loop i am getting array in a way I want but when i try to build that array with logging temperature i am not able to do it. Please guide me through ths.

 

Thank You

Hnagpal

Download All
0 Kudos
Message 1 of 9
(2,939 Views)

I could try to help if you could save VI in 2009 version and post.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 9
(2,926 Views)

I didn't try to really clean this up, because I think this gives the output you want, but is going to still cause you problems at the next step.  Your whole looping setup is just incorrect.I removed your internal loop and made the single line (1D array) into a 2D array for display in the table, but this won't handle when you want a new line.

 

I'm still trying to figure out what you want your final output to look like and if it is in this VI.  I don't undertsand what the outside for loop is supposed to do other than to generate the data twice.  I think you want the outside loop to make one row for each iteration.

0 Kudos
Message 3 of 9
(2,923 Views)

Thanks odessy27Matthew Kelton, for replying.

 

Matthew Kelton: Thanks for the solution i am adding outer loop so that i can increase the number of row. I am using it for some application which require me to save data several time and i used random number here but originally instead of random number there will be power meter reading and i want to save it every hour and plot it. I am also attaching a file what i made I don't know is this a good way or not. Actually i will also beneeded to plot a graph. But again how to increase a row and without replacing previous data i can write another row.

Yes i want to make one row for each iteration.

 

I attached both files in 2009 version.

 

Thank You


Himanshu Nagpal 

Download All
0 Kudos
Message 4 of 9
(2,904 Views)

I made a vi as  you suggested by removing inner for loop.

0 Kudos
Message 5 of 9
(2,882 Views)

Hi Himanshu,

 

In order for you to save multiple rows of data, you should use shift registers to carry your array of data through each iteration of your for loop, and then add the next row of data onto the bottom of your array. I've attached an example that generates a row of random numbers in each iteration of a for loop, and then adds that row of random numbers to the bottom of an array each time that the loop executes. Using a similar method, you should be able to generate data in the format that you want. I notice in your code that you're using a 32-column array, but you only have five columns of data. Is there a reason for this?

 

Best,

Dan 

Applications Engineer

National Instruments

http://www.ni.com/support

 

Message 6 of 9
(2,854 Views)

Hi Dan,

 

Thanks for replying. In total data will be stored in 33 columns. 1 will be temperature and 32 for meter reading which is taken from each port in the switch. I made the vi as you guided but can you help me in 1 more thing. I am reading a file from spreadsheet where i am writing. I only need 2nd row to make refrence because first row will be headings. And i want to subtract every reading from it. ex

 

refrence row

 

1 0.4  0.8  0.9 .............................so on

 

table which i want should be some what

 

0      0      0     0 .................................. so on  (since this is first row after heading and this row has been made refrence so anything that i will be subtracting will become zero)

0.1   0.3   0.01 0.2 --------------------------  so on

 

Now i am reading it gives me two row but how to get only 1 row.  And can we increase precision while reading from spreadsheet. When we are writing to spreadsheet we have 6 values after decimal but while reading weget 3 values after reading from spreadsheet.

 

Thank You

Regards

Himanshu 

0 Kudos
Message 7 of 9
(2,838 Views)
Solution
Accepted by topic author Hnagpal

Hi Himanshu,

 

In order to start reading your array from the second row, you can use an Index Array function once you've loaded the array from your spreadsheet file. The Index Array function can be found on the Functions Palette under Functions>>Programming>>Index Array. The LabView help is very useful in explaining how to use this function. 

 

As for the issue of the precision of the numbers when you read them, the spreadsheet file that you're reading is formatted as a Fractional String, since you converted it to a Fractional String before saving. In order to recover all of the precision, read the spreadsheet in as a String, and then convert it back to a Fractional String using a Fract/Exp String to Number conversion function. This function is on the Functions palette at String>>String/Number Conversion>>Fract/Exp String to number. The LabView help is also very useful in explaining how this function works.

 

Best,

Dan Nelson

Applications Engineer

Message 8 of 9
(2,826 Views)

Thanks Dan that really helped.

 

Regard

Himanshu Nagpal

0 Kudos
Message 9 of 9
(2,819 Views)