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
 Using RemoveAt() with loose dataset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

leftside

3 Posts

Posted - 04/21/2013 :  12:41:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0
Operating System: Windows 7

Why is it that

dataset temp={1,2};
temp.RemoveAt(2);
temp[2]=;

returns nothing as expected but

dataset temp={1,2};
int index=2;
temp.RemoveAt(index);
temp[2]=;

returns temp[2]=2?

cdrozdowski111

USA
247 Posts

Posted - 04/22/2013 :  06:25:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Wrap the int variable passed to RemoveAt() in $(). See code below. I changed the var names as I wasn't sure whether either "temp" or "index" might be reserved words or vars in LabTalk.


dataset dsTemp={1,2,3};

int nIdx = 2;

dsTemp.RemoveAt($(nIdx));

for (int nn = 1; nn <= dsTemp.GetSize(); nn++)
{
	type $(dsTemp[nn]);
}


Edited by - cdrozdowski111 on 04/22/2013 06:28:19 AM
Go to Top of Page

leftside

3 Posts

Posted - 04/22/2013 :  10:41:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks! Still learning when I have to use %() and $()...
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