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
 filenames with $() substitution
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jonni

United Kingdom
58 Posts

Posted - 10/16/2003 :  2:09:11 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

Can anyone help resolve the following. The following script does not work due to data$(ii) not being able to be used as winName in [winName]!wks.addcol(). You should see what I am trying to do in the script -- I have a series of datasets with the name a055sXXX where XXX is 001,002,003,etc and want to do some simple operation to all sets.

for (ii=1;ii<=100;ii++)
{
if (ii<10)
{
a055s0$(ii)!wks.addcol();
a055s00$(ii)_c=a055s00$(ii)_b/1.3E-3;
};
if (ii>=10 && ii<100)
{
a055s0$(ii)!wks.addcol();
a055s0$(ii)_c=a055s0$(ii)_b/1.3E-3;
};
if (ii>=100)
{
a055s$(ii)!wks.addcol();
a055s$(ii)_c=a055s$(ii)_b/1.3E-3;
};
}

Is it true that such substitution does not work? How can I correct this? Any additional simplification to the script possible?

Many thanks.

jonni

Mike Buess

USA
3037 Posts

Posted - 10/16/2003 :  5:20:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi jonni,

There was a topic very similar to this a few months ago but I can't find it now. As I recall, the solution was to use an intermediate string variable as shown below.

for (ii=1;ii<=100;ii++)
{
if (ii<10)
{
%A=a055s00$(ii);
%A!wks.addcol();
%A_c=%A_b/1.3E-3;
};
if (ii>=10 && ii<100)
{
%A=a055s0$(ii);
%A!wks.addcol();
%A_c=%A_b/1.3E-3;
};
if (ii>=100)
{
%A=a055s$(ii);
%A!wks.addcol();
%A_c=%A_b/1.3E-3;
};
}

Hope that helps.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/16/2003 5:22:47 PM

Edited by - Mike Buess on 10/16/2003 5:25:46 PM
Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/17/2003 :  01:53:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi jonni,
this might be another solution for your task:

doc -e W { // scan all wks in project %H holds wks name;
if (%[%H,6]=="a055s") { // check if wks starts with your name;
%H!wks.addcol(); // add column;
%H_c=%H_b/1.3E-3; // do calculation;
};
};

hope this helps and simplifies...
Tilman.

Go to Top of Page

jonni

United Kingdom
58 Posts

Posted - 10/17/2003 :  1:51:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike and Tilman,

Thank you for your suggestions -- they both work beautifully.

Best regards,

jonni
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