LabWindows/CVI User Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Based on CVI SQL Tooklit to save datas automaticly in excel.

Hello,everyone!

I want to save the datas displayed in the meter panel.There are 7 meter panels and will display datas at the same time.

I want to save the data when the meter panel displays. As the serial port received datas constantly,I need save these datas automaticly.

Someone tells me could use CVI SQL Tooklit,but I am not able to use it now.

Is there anybody could give me some directions or advices? Or give me some similar examples .which is  based on CVI SQL Tooklit to save datas automaticly in excel.

Thank you very much !

xiepeilin0826@126.com

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 1 of 6
(9,073 Views)

Hello everyone!

I need your help ! I really don't know how to use CVI's SQL Tooklit.

I expect your advice to use CVI's SQL Tooklit.

Thank you very much.

I would appreciate your help.

Regards

xiepei

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 2 of 6
(5,100 Views)

Hello xiepei,

I'm not sure that CVI SQL Toolkit is the best way to save data for loading in excel.

based on the source i provide you in the other thread, you can save your data as a csv file format and load it in excel.

just google csv file format and i'm sure you can achieve your goal.

regards.

B.Williot

0 Kudos
Message 3 of 6
(5,100 Views)

Hello B.Williot

Thanks.I really appreciate your help.

I have known csv file fomat after google analytics.

I have known how to use csv file format.But I meet a problem.

I want to save datas in .csv file as follows:

Data            Time                   Temperature(℃)    Humidity(%)     O2 density(%)

2011-4-1     13:19:38            20                       20                   21

2011-4-1     13:29:38            20                       20                   21

2011-4-1     13:39:38            20                       20                   21

2011-4-1     14:49:38            20                       20                   21

2011-4-1     14:59:38            20                       20                   21

2011-4-1     14:09:38            20                       20                   21

Howerver,I could not add the line"Data    Time            Temperature(℃)      Humidity(%)     O2 density(%)" above.

It is always following the datas.Such as:

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     13:19:38            20                    20               21

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     13:29:38            20                    20               21

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     13:39:38            20                    20               21

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     14:49:38            20                    20               21

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     14:59:38            20                    20               21

Data            Time                   Temperature      Humidity     O2 density

2011-4-1     14:09:38            20                    20               21

My program statement are:

             f = fopen ("yibiao.csv", "a+");

             if( f != NULL )

            {

               fprintf(f,"Data,Time,Temperature,Humidity,O2\n")

               fprintf (f, "%s  %s     ",DateStr(),TimeStr());

               fprintf(f,"temperature   %g,humidity   %g\n\n",TEM,HUM,O2,);

              fclose(f);

             }

Would you please help me point out my mistake?

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 4 of 6
(5,100 Views)

Hello Xiepei,

You must write your header line only once in your output file.

the following line must be executed only one time ( at program initialization for example)

>>> fprintf(f,"Data,Time,Temperature,Humidity,O2\n")

After you will  write only data lines.

Regards.

B.Williot

Message 5 of 6
(5,100 Views)

Hello B.Williot

Thank you  very much for your help.
I add the following lines to my procedure.

f = fopen ("yibiao.csv", "w");
fprintf (f, "Data,Time,CO2,O2,Temperature,CO,Humidity,H2S,CH4\n");


No matter how long I executed the procedure,it would excute the above lines only one time and the procedure would stop there,if the lines were not commented out.
So I execute the procedure only one time and then comment out the above lines, and continue execute the procedure.It will appear what I want in the .csv file.See the attchment:

However,I have a question that our users may think this usage of trouble.

What do you think this usage ?

Best regards.

xiepei

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 6 of 6
(5,100 Views)