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
 LabTalk Forum
 copy row value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kdsaransh

India
89 Posts

Posted - 01/14/2017 :  01:22:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi i am using origin 9.1.

I want to copy row 294 and col D and E value. I also want to copy row 236 and col E value.

Now i want to place these values into another new workbook in particular sequence. The value of row 236 and col E should go into 1st col of this new workbook and the value row 294 and col D and E to col 2 and 3 respectively of this new workbook.

And i have many workbooks and i want to do the same operation for all. That is, the next value should come below the first value and so on.

Any help...

Thanks

Rajesh Agarwal

Edited by - kdsaransh on 01/14/2017 01:25:57 AM

cpyang

USA
1406 Posts

Posted - 01/15/2017 :  2:45:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Simplest way to do this is to write a simple LabTalk script. You can begin by reading about Range notation in LabTalk:

http://www.originlab.com/doc/LabTalk/Tutorials/Tutorial-Range-Notation

Code will look something like this


range sd = [book1]1!col(d);
range se = [book1]1!col(e);
range dest1=[book2]1!wcol(1);
range dest2=[book2]1!wcol(2);

int nr = 294;
dest1[1]=sd[nr];
dest1[2]=se[nr];


CP
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 01/16/2017 :  01:09:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
Thanks for the repkly,

But I has more than 1000 workbooks with different names.

my code looks like:

newbook name:="Charge Pump" sheet:=1;
Col(1)[L]$="Frequency";
Col(2)[L]$="ITotalavg_Drain";
Col(1)[U]$="Hz";
Col(3)[L]$="abs ID";
Col(4)[L]$="Normalised ID";

Col(5)[L]$="ITotalavg_Source";
Col(6)[L]$="abs IS";
Col(7)[L]$="Normalised IS";

csetvalue col:=[Charge Pump]Sheet1!col(3) formula:="abs(col(b))" recalculate:=1;
csetvalue col:=[Charge Pump]Sheet1!col(4) formula:="col(c)/4.45966e-9" recalculate:=1;

csetvalue col:=[Charge Pump]Sheet1!col(6) formula:="abs(col(e))" recalculate:=1;
csetvalue col:=[Charge Pump]Sheet1!col(7) formula:="col(f)/4.45966e-9" recalculate:=1;

Int n= 100;
ii = 1;
for(int ii = 1; ii<=n; ii++)
{

wrcopy iw:=[ResultBook]1! r1:=ii r2:=ii c1:=7 c2:=7 dr1:=ii dc1:=1 ow:=[Charge Pump]1!;
wrcopy iw:=[ResultBook]1! r1:=ii r2:=ii c1:=4 c2:=4 dr1:=ii dc1:=2 ow:=[Charge Pump]1!;
wrcopy iw:=[ResultBook]1! r1:=ii r2:=ii c1:=5 c2:=5 dr1:=ii dc1:=5 ow:=[Charge Pump]1!;

}

// plot Charge Pump vs Frequency
plotxy iy:= [Charge Pump]Sheet1!(1,2) ogl:=[<new template:="C:\Users\Babia-pc\Documents\OriginLab\91\User Files\Averageexp.otp" name:=samplegraph>];
page.longname$="Charge Pump VS Frequency"; // change the graph name.

layer -a;

legend.color=2; // make the legend colour red ( 2 is the index color of red)

legend.text$ = "\b(%(legend.text$))";// ( make the legend text bold)

plotxy iy:= [Charge Pump]Sheet1!(1,5) ogl:=[<new template:="C:\Users\Babia-pc\Documents\OriginLab\91\User Files\Averageexp.otp" name:=samplegraph>];
page.longname$="Charge Pump VS Frequency2"; // change the graph name.

layer -a;

legend.color=4; // make the legend colour red ( 4 is the index color of blue)

legend.text$ = "\b(%(legend.text$))";// ( make the legend text bold)

range q=[ResultBook];// now delete the result book.
del q;


I am not getting the value of the frequency in col 1 of the charge pump sheet.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/16/2017 :  06:20:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I don't see any Range notation direct assignment as I had pointed out. There is no need to use wrcopy, just define the range variable for the data column and make assignments.

CP
Go to Top of Page

kdsaransh

India
89 Posts

Posted - 01/16/2017 :  07:40:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot.

Regards,
Rajesh Agarwal
Go to Top of Page

Neonly

Malta
1 Posts

Posted - 02/03/2017 :  03:33:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by kdsaransh

Hi,
Thanks for the repkly,

But I has more than 1000 workbooks with different names.



Smarter choice to write a script than to do it manually when you have some many spreadsheets of data to analyze.



Jonas

Edited by - Neonly on 03/20/2017 1:52:59 PM
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