The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Importing Datasets with an Origin-C-code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

markus.w

1 Posts

Posted - 04/23/2012 :  08:51:52 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everybody,

I want to handle the following task, but I am not really an advanced programmer so I hope you guys can help me and/or give me some advice and inspiration:

I have a set of datas , they are all of the same structure, so I
want to make a routine that creates me everything.

This datafiles represent meassurement of Voltage and Power.

I need from each datafile the first line of meassurement (voltage and power) and write every first line in one new book, and then from every datafile the second line and write it again in a new book and so on for all lines.
So, if I have e.g. 50 lines in each datafile, there are at the end 50 books.

Thanks for Helping!
LG Markus



Penn

China
644 Posts

Posted - 04/24/2012 :  02:49:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

From your description, I think you can first import your data into a worksheet first, and then re-arrange the data into different workbook, which will be more easier.

After importing the data into a worksheet, you can run the following script to put one line into a new workbook. Also, you can put the script for running after importing. Please note, the data is copied from one line to the first line of new book. If you have different requirement, you need to change the corresponding script.

string strBookName$ = %H;  // get the original book name
int nRows = wks.maxRows;
int nCols = wks.nCols;
for(nRowIdx=1; nRowIdx<=nRows; nRowIdx++)
{
	range rrSr = [strBookName$]1!col(1)[nRowIdx]:col($(nCols))[nRowIdx];  // source row
	newbook;  // create a new book
	wks.nCols = nCols;
	range rrDe = col(1)[1]:col($(nCols))[1];  // destination row
	copydata rrSr rrDe;  // copy data
	sec -p 0.1;  // pause for 0.1 second
}
win -cd %(strBookName$);  // delete the original book


Penn

Edited by - Penn on 04/24/2012 02:49:51 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000