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
 deleting values from dataset (not worksheet)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

iggboert

Germany
7 Posts

Posted - 11/17/2009 :  07:51:44 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8 and Service Release SR4:
Operating System: WinXP

Hello,

to delete some selected data of a worksheet i used this:

wxt "col(4)[i]<0.001" sel:=1; 
menu -e 36442; 


but now i want to make the code more efficient because i have tons of data.
Now i'm using datasets to calculate and for analysis. i wanted to use the following code to erase the nonnecessary data. But it doesnt work on a dataset, only on a worksheet. Any suggestions?


dataset temp1 = {1,2,3,4,5,6,7,8,9,0};
for(i=10,i=0,i--)
{
    if(temp1[i]<=5||temp1[i]>=3)
    {
    mark -d temp1 -b i -e i;
    // tried also "mark -d temp1[i]"
    };
};


Regards
Christoph

easwar

USA
1964 Posts

Posted - 11/19/2009 :  09:28:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Christoph,

Sorry for the late response, we do not have a method in LT to delete elements in a temp dataset, thanks for the suggestion, we will add this in a future service release/version.

For now methods exist in Origin C for deleting elements of a vector etc, so you may want to consider using Origin C

Easwar
OriginLab
Go to Top of Page

greg

USA
1378 Posts

Posted - 03/22/2010 :  5:06:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We have added the RemoveAt method to remove elements of a loose dataset based on index. You can now use:

dataset temp1 = {1,2,3,4,5,6,7,8,9,0};
temp1.removeat(9); // Removes '9'
temp1.removeat(7); // Removes '7'
temp1.removeat(5); // Removes '5'
temp1.removeat(3); // Removes '3'
temp1.removeat(1); // Removes '1'
col(1)=temp1; // Now equals (2,4,6,8,0}

dataset temp1 = {1,2,3,4,5,6,7,8,9,0};
temp1.removeat(1); // Removes '1'
temp1.removeat(3); // Removes '4'
temp1.removeat(5); // Removes '7'
temp1.removeat(7); // Removes '0'
temp1.removeat(9); // Does nothing - index out of bounds
col(2)=temp1; // Now equals {2,3,5,6,8,9}
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