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
 filenames with $() substitution

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
jonni Posted - 10/16/2003 : 2:09:11 PM
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
3   L A T E S T    R E P L I E S    (Newest First)
jonni Posted - 10/17/2003 : 1:51:24 PM
Hi Mike and Tilman,

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

Best regards,

jonni
tib Posted - 10/17/2003 : 01:53:01 AM
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.

Mike Buess Posted - 10/16/2003 : 5:20:24 PM
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

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