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
 Transferring Vector from C to LabTalk
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Belsinga

Netherlands
28 Posts

Posted - 06/24/2010 :  04:54:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8E
Operating System: Win XP

Hello,

I am trying to tranfer a vector from C to LabTalk, but it seems that LabTalk cannot adress such a vector?

** in C: ****************************************
for(ii=0;ii<vsGraphsA.GetSize();ii++)
{
LT_set_str("FileN[ii]",vsGraphsA[ii].Right(14));
}

*** in LT: ***************************************

StringArray tFN;

for(yy = 0; yy<vsA; yy++)
{
type $(FileN.GetAt(yy));
type $(FileN[yy]);
}

Penn

China
644 Posts

Posted - 06/29/2010 :  02:41:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can try the following solution.

1. In Origin C

void test_lt_sa()
{
	vector<string> vs = {"This", "is", "a", "test"};
	
	LT_execute("StringArray bb;"); // define a LabTalk StringArray variable
	
	for(int ii=0;ii<vs.GetSize();ii++)		
	{		
		LT_set_str("%L", vs[ii]);  // add string to %L		
		string strCmd = "bb.Add(%L)";  // add %L to string array
		LT_execute(strCmd);  // execute the LabTalk script
	}
}

2. In LabTalk

loop(ii,1,bb.GetSize())
{
  string str$=bb.GetAt(ii)$;
  str$=;
} 


Penn
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