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
 calculating with different worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

abreiti

Germany
Posts

Posted - 11/29/2006 :  06:01:56 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello!

I want to calculate the sum of every point of a layer with different datasets:
1. I count all datasets
2. I build a new worksheet
3. I build a for-loop over all datasets
4. I want to add all datasets to column 1

Here's my LabTalk-Script - that doesn't work:

layer -c; //count all datasets
win -t wks; //new worksheet
for (ii=1;ii<=count;ii++)
{
col(1) = col(1) + %[%z,#$(ii)];
};

Maybe somebody can help.

Mike Buess

USA
3037 Posts

Posted - 11/29/2006 :  07:24:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It doesn't work because col(1) has no values to begin with and adding anything to a missing value yields a missing value. Try this...

layer -c; //count all datasets
win -t wks; //new worksheet;
col(1)=%[%Z,#1];
for (ii=2;ii<=count;ii++)
{
col(1) = col(1) + %[%z,#ii];
};

Mike Buess
Origin WebRing Member
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