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
 fill/set cell of worksheet with value/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

asenv

35 Posts

Posted - 06/05/2010 :  2:50:01 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1G SR1
Operating System: Windows 2000 Pro

I have strange problem. I want to set the values of cells of worksheet. I made this loop that does not work:

win -t d 123 data1;
for(ii=1;ii<6;ii++)
{
range wksrange = [data1]1!ii;
//type "$(ii)";
for(jj=1;jj<250;jj++)
wksrange[jj]=jj;
}

Why?
The columns should be added automatically. If I make the same thing from labview (the for loops with labview) and on every iteration execute the commands (like range wksrange = [data1]1!5; wksrange[2]=2;) then it works. But not quite. It works when it is done slowly (on a slow computer). On a faster one the values of the columns in the first row are not set correctly very often. Every time is different. I presume the automatic creation of the columns takes some time that leads to not correct execution of next command which is to set data on 1st row. I do not know, but I need solution or workaround.

P.S.
I tried also with this loop:

loop(ii,1,6)
{
range wksrange = [data1]1!ii;
//type "$(ii)";
loop(jj,1,25){
wksrange[jj]=jj;}
}

Cheers
Asen

Penn

China
644 Posts

Posted - 06/08/2010 :  04:14:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Asen,

Maybe there is some thing wrong with the range definition. Substitution notation is needed here. You can try the following script.

win -t d 123 data1;
for(ii=1;ii<6;ii++)
{
	range wksrange = [data1]1!$(ii); // need $() substitution, 
    // can also use no substitution like that: range wksrange = [data1]1!wcol(ii);
	//type "$(ii)";
	for(jj=1;jj<250;jj++)
		wksrange[jj]=jj;
}

To make the command finished before the next, you can use the second command to pause for the specified number of seconds.

Penn
Go to Top of Page

asenv

35 Posts

Posted - 06/12/2010 :  05:50:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot Penn, now it works perfect.

Cheers
Asen
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