Experience Origin

zhaozj2021-02-16  41

I recently gave someone to make a small software, mainly using Origin C to achieve the function of Origin's batch data. I have never used Origin tools. If you use it to find it very easy to use, especially the hand has some Experimental data wants to use it to analyze, the statistics use to write the papers. Here you have to introduce the technology I use.

Be a brief introduction first:

Origin is a data analysis and drawing software from Microcal, USA, and now the highest version is 7.0 http://www.originlab.com/.

Features: Use simple, intuitive, graphical, object-oriented window menu and toolbar operation, fully support the right mouse button, support the moving drawing drawing, etc.

Two major categories: data analysis and drawings. Data analysis includes various perfect mathematical analysis functions such as sorting, adjustment, calculation, statistics, spectral transformation, curve fit. After preparing the data, when performing data analysis, simply select the data to be analyzed, then select the response menu command. The drawing of the .origin is template based on the template. Origin itself provides dozens of two-dimensional and three-dimensional drawing templates. Allow users to customize templates themselves. When drawing, just select the desired template. Users can customize math functions, graphical styles, and drawing templates; can be connected to various database software, office software, image processing software, etc., can write data analysis programs with advanced languages ​​such as C, and can be used with built-in LAB Talk language Programming, etc.

For other basic, please go online to search. What I want to do is to generate an origin engineering file under a directory (including subdirectory and file), and draw according to data drawing.

because:

1. Use Origin C and Labtalk hybrid programming to implement the file auto enumeration and data into batch processing. ORIGIN C is good at logic processing, Labtalk is good at ORIGIN7's built-in operation.

2. Users as long as entering the directory you want to process, the program is batch generation to generate .opj files are named after the requirements .opj files are placed in the corresponding directory.

Void ImportandPlot (String Strfile) // Process Data, Incoming File Full Path Name, Drawing Processing

{

String cmd = STRFILE;

INT POS = Strfile.reversefind ('//');

String WKS;

String path = strfile.mid (0, POS 1);

cmd.insert (0, "open -w");

LT_EXECUTE (CMD); // Execute the labtalk operation, and then the same.

Double ncols;

LT_GET_VAR ("WKS.NCOLS", & ncols;

Char sztemp [100];

LT_GET_STR ("% H", SZTEMP, 100);

WKS = sztemp;

LT_EXECUTE ("Win -T Plot Line");

For (INT i = 2; i <= ncols; i )

{

cmd.format ("%% b =% s! wks.col $ (% d) .Name $", WKS, I);

LT_EXECUTE (CMD);

cmd.format ("Layer -i% S_ %% B", WKS);

LT_EXECUTE (CMD);

LT_EXECUTE ("Layer -a");

cmd.format ("%% b =% s! wks.col $ (% d) .Label $", WKS, I);

LT_EXECUTE (CMD);

Char sztemp [100];

LT_GET_STR ("% B", SZTEMP, 100);

String STR (SzTemp);

POS = str.reversefind ('); str.delete (POS, Str.getLength () - POS);

cmd.format ("Save% S% S.Opj", Path, STR);

LT_EXECUTE (CMD);

}

LT_EXECUTE ("DOC -N");

}

Void Dir (String Strfile) // Traverse all files under the specified directory and call the data processing function ImportandPlot

{

WIN32_FIND_DATAA FIND;

Handle hfile;

String strfolder;

IF ((HFile, & Find)! = invalid_handle_value)

{

While (FindNextFile (Hfile, & Find))

{

Strfolder = STRFILE;

Strfolder.delete (Strfolder.getLength () - 3, 3);

Strfolder.insert (Strfolder.getLength (), Find.cfileName;

IF (strfolder.right (4) .comparenocase (". txt") == 0)

{

ImportandPlot (Strfolder); // Handling TXT files

}

Else IF (strfolder.find ('.') == -1) // (sub) folder, continue to traverse

{

Strfolder.insert (Strfolder.getLength (), "//*.*");

DIR (Strfolder);

}

}

FindClose (HFILE);

}

Else

Printf ("% s: file (s) not found / n", strfile;

}

Void test ()

{

String Strfile = InputBox ("Please enter the full path of the data directory to be processed:");

Strfile = "//*.*";

DIR (Strfile);

}

Instructions for use:

1. Save the above file as h.c

2. Copy H.C to originLab / OriginPro70 / OrigInc.

3. Custom.Ogs overrides the OriginLab / OriginPro70 directory of Custom.ogs.

4. Start Origin7 software and click the "Custom Routine" button on the toolbar.

5. Enter the directory where you want to process the data in the pop-up box, then click OK, wait for your computer to batch.

Of course, you can also use other ways to call the program, readers yourself to study, not introduced here.

转载请注明原文地址:https://www.9cbs.com/read-26340.html

New Post(0)