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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Using RemoveAt() with loose dataset

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
leftside Posted - 04/21/2013 : 12:41:46 PM
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?
2   L A T E S T    R E P L I E S    (Newest First)
leftside Posted - 04/22/2013 : 10:41:11 AM
Thanks! Still learning when I have to use %() and $()...
cdrozdowski111 Posted - 04/22/2013 : 06:25:35 AM
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]);
}


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000