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
 set column data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

moondream

Netherlands
22 Posts

Posted - 09/20/2002 :  10:16:01 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi, all,

how can i set data in an inactive worksheet column?
I can set col(3)= 4 in an active worksheet, but I could not set data1.col(3)=4, how could i do that?


thanks

moondream

moondream

Netherlands
22 Posts

Posted - 09/20/2002 :  10:38:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
sorry i know how to do it, but i can not set the data to a empty worksheet by data1_b=3.

best regards,

moondream

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/20/2002 :  10:50:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi moondream,

Try this...

nrows=512; // decide how many rows you want
set data1 -er nrows; // set the wks to that size
data1_b=data(1,nrows); // fill col B with a data set (may not be necessary)
data1_b=3; // set it to the correct value

Mike Buess
Origin WebRing Member
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/20/2002 :  11:26:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Thanks alot. I do need "data1_b=data(1,nrows)".
May ask you another question? How can i copy all the B columns in other worksheets to a new worksheet (supposed name RESULT)? Should i use "doc -e w{ }", but how do i avoid to copy the B column of RESULT?

best regards,

moondream
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/20/2002 :  12:03:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The name of the wks that is being handled in each iteration of doc -e W can be accessed by the string variable %H. So only do your copying if %H is not RESULT...

doc -e W {
if(%H!="RESULT") {
-- your copy scripts go here --
};
};

Mike Buess
Origin WebRing Member
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/21/2002 :  06:46:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Mike,

I do it like following,
ncol=2;
doc -e w{
ncol= ncol+1;
if (%h !="sumresult"){
%(sumresult,ncol)=%h_b[sumresult_a]}
};
is it right?, it doesn't work. could you tell me what wrong with it?
thanks.

moondream
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/21/2002 :  10:48:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi moondream,

It's hard to tell without knowing exactly what you want the script to do and what happens instead (how does it go wrong?), but here are a few things to consider...

1> In order for the script to work, 'sumresult' must already have the correct number of columns. (Based on your other posts in this thread I bet you've set it up properly.)

2> The column index 'ncol' should probably be incremented within the if() statement or you will end up with a blank column in 'sumresult'.

3> 'sumresult_a=;' returns the first value in the dataset 'sumresult_a'. If that value is 3 the command in your if() statement becomes %(sumresult,ncol)=%h_b[3]. Is that what you intended? If not, pls explain what you want to do. Judging from your previous post I thought you wanted to copy the entire col B to 'sumresult'.

Here is how I would rewrite your script based on those points. (I also assume that 'sumresult' is already set up.) I've assigned the wks name to a string variable because it shortens the scripts and makes them easier to change if you decide to rename the wks.

%W=sumresult;
ncol=2;
doc -e W {
// when comparing string variables you must quote both of them
if("%H"!="%W") {
ncol++; // increment ncol
%(%W,ncol)=%H_B[%W_A]; // as you wrote it
-- or --
%(%W,ncol)=%H_B; // if my guess is right (but it seldom is )
};
};

Does that help you any?

Mike Buess
Origin WebRing Member
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/22/2002 :  04:53:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Mike,

Thank you very much. You make it sooooooooo clear. I know where it was wrong now. Thank you for your patient again.

best regards,

moondream
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/22/2002 :  10:16:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Mike,

One more question, please.
How could I only copy the columns of the worksheets which are non-minimized?

Thanks

Best regards,

moondream
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/22/2002 :  1:26:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi moondream,

doc -e O operates only on non-minimized windows, but you will have to check each window to make sure it's a worksheet. You can do that with the exist() function (look for it under Miscellaneous (Utility) Functions in LabTalk help)...

doc -e O {
if(exist(%H,2)==2 && "%H"!="%W") {
-- your scripts go here --
};
};

Mike Buess
Origin WebRing Member
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/23/2002 :  05:22:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Mike,

Thank you very much.

Best regards,

moondream
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