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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Copying a column from one worksheet to another

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
psgst Posted - 11/21/2006 : 05:56:09 AM
Hi folks,

I have two worksheets. percWork and Bin1. I want to copy the first column from Bin1 into the first (empty) column of percWork. I'm trying to do this by using:

percWork_A = Bin1_A;


But this isn't working. It won't work in the script window and it won't work in my LabTalk script. Am I doing anything wrong? Is there a better way? Are there any reasons why this code won't work?

Cheers.

9   L A T E S T    R E P L I E S    (Newest First)
psgst Posted - 11/22/2006 : 09:04:42 AM
Okay, here is the offending code section:


run.section(Standard,NewWks);
%B = %H;
window -r %B percCirc;
percCirc_PopulationStats = Bin2_PopulationStats;
percCirc_Value = (Bin2_Counts1/%(statsOnDOrig,22,1))*100;
worksheet -s 1 0 2 0; // select all rows in columns 1 and 2
run.section(Plot,Column);
label -p 80 1 -s -n nval \b(%(statsOnDOrig,22,1));
label -p 75 1 -s -n nlab "\b(N=)";
label -r legend;
layer1.x.label.divideby = 1;
layer1.x.from = 0;
layer1.x.inc = 0.1;
layer1.x.to = 1.1;
layer.x.showgrids = 1;
layer.y.showgrids = 1;
second -p 1;
layer1.x.grid.majorColor = 1;
layer1.y.grid.majorColor = 1;
// might stop here
second -p 1;
set percCirc_Value -pfc 1; // set column pattern foreground colour
set percCirc_Value -pbc 1; // set column pattern background colour
set percCirc_Value -pfp 0; // set column fill pattern
set percCirc_Value -pfb 12; // set column background colour
set percCirc_Value -cf 12; // set fill colour
layer.y.color = 1;
layer1.x.inc = 0.1;
label -n XB \b(\p120(Particle shape (profile circularity)));
label -n YL \b(\p110(\c12(Particle frequency (percentage by number))));
%A = %(sheet1,10,1); //get contents of excel cell
%P = %[%A, 1:((%[%A]-3)/2)-20]; //get user text
%Q = %[%A, %[%A]-7:%[%A]]; //get session time
label -d 450 200 -s \b(\p120(\c14(\p144(Shape (circularity) - )%P - %Q)));
%B = %H;
window -r %B percCircHist;


I think it stops around the point where I have included the comment "//might stop here" but I cannot see any reason why. Can anyone shed some light on why this block of code might not work? Or give the desired result? (Which is a graph to the right scale)



Edited by - psgst on 11/22/2006 09:07:52 AM
psgst Posted - 11/22/2006 : 05:06:57 AM
Mike,

I tried looking into that but the axis is using 'Text from dataset' rather than 'Numeric', so I cannot set the divide by factor under the current setup. I changed to Numeric for argument sake and set the divide by factor to 1, which changed the axis but the graph remained the same, just a huge red block on the far right that looks like a blown up small column (which it is).

I know that this is not how the graph should look because if I change the axis to say 0 to 11 it shows the full graph at normal size, but with incorrect axis. However I cannot do this in my script because the script needs to be precise and robust.

Mike Buess Posted - 11/21/2006 : 2:30:47 PM
layer.x.label.divideby=1;

Mike Buess
Origin WebRing Member
psgst Posted - 11/21/2006 : 2:01:22 PM
Okay I'll try that. Is there a way to set the divide by factor in LabTalk?

Mike Buess Posted - 11/21/2006 : 11:46:24 AM
Select Format > Axis Tick Labels > X Axis Tick Labels and change Divide by Factor from 40 (0.1/0.0025) to 1.

Mike Buess
Origin WebRing Member
psgst Posted - 11/21/2006 : 10:51:59 AM
Okay I got that working.

I do have another question for you though, Mike. I've got a histogram plotted in a LabTalk script and I'm trying to set the X axis to encompass the values 0 through 1.1 - I am doing this with the following code:

layer1.x.from = 0;
layer1.x.to = 1.1;
layer1.x.inc = 0.1;


The layer number is correct, and those are the correct values. However instead I am seeing the range 0 to 0.0275. I have tried setting layer1.x.to = 1.1 in the script window with the same result. As far as I can tell the graph is seeing each 0.1 as equal to 0.0025 on the axis ... so when I set 1.0 I get 0 to 0.025 ... when I set 1.1 I get 0 to 0.0275 etc etc.

Where am I going wrong?

Mike Buess Posted - 11/21/2006 : 08:15:03 AM
The only possibility I can imagine is column A of Bin1 is locked. If so you'll see a padlock in the column label. To unlock select Set Column Values and uncheck the AutoUpdate option.

Mike Buess
Origin WebRing Member
psgst Posted - 11/21/2006 : 08:08:12 AM
Nope, I'm not spelling the names wrong. This is strange. Are there any settings that might be on the template that could stop me copying into that particular column?

Mike Buess Posted - 11/21/2006 : 07:55:46 AM
Works fine for me, both from script window and LabTalk script, as it should. Perhaps you are spelling one of the worksheet names wrong?

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000