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
 Import using string arrays

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
Clairekun Posted - 08/11/2020 : 2:26:44 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Windows 10

Hello,

I have a complex importing LT code with several for () commands, each one of which addresses a set of subfolders one level deeper than the last.

I need to run the same exact code for 2 different folders, say, A and B. I intend to create a project folder structure where folder A is created, imports the corresponding datasets, and then creates a second folder called B, importing its own datasets.

I created a string array adding A and B. The (very) simplified version of my code is:

string strPath$ = "D:\Samples\";
path$ = strPath$;
stringarray Fols; 
Fols.add("A");
Fols.add("B");
loop(hh,1,Fols.GetSize())
{	
string ProjFols$ = Fols.GetAt(hh)$;
pe_mkdir folder:=ProjFols$ cd:=1;

//Several For commands here

string FolPath$ = strPath$+(Several strings from previous For commands)+ProjFols$;
path$ = FolPath$;

//impASC fumction

pe_cd /
}

The code works perfectly, but only for folder A. Folder B never gets created or imported from.

Am I using Loop comand wrongly? I tried ProjFols$=; first to see if the strings were listed correctly, and they were. Also, it strikes me as weird that it does read A, but not B. If the code made no sense, I wouldn't expect to have anything imported.
2   L A T E S T    R E P L I E S    (Newest First)
samajkapoor Posted - 09/20/2020 : 11:53:07 AM
Is this solve?
Clairekun Posted - 08/12/2020 : 5:02:40 PM
Update: I managed to get it working.

There was a For command between the stringarray loop and the first time ProjFols$ was used (pe_mkdir folder:=ProjFols$); apparently, it will not work correctly if the loop is not directly above.

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