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
 Character formatting

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
amorris Posted - 08/31/2006 : 6:01:08 PM
Origin Version (Select Help-->About Origin): 7.5 R6
Operating System:winXP

Hi everyone,

Can anybody tell me how to format the number "0" (ie, zero) as "0.000" in a labtalk script?

I have a loop that imports files with filenames "file_r=0.000.dat" to "file_r=1.000" where r is incremented in steps of 0.001. For r not equal to 0, I can simply use %N=file_r=$(rot,.4).dat, but when the value of my variable is "0", origin doesn't respect my formatting request. Any way to get around this?

Thanks!

Alexis
5   L A T E S T    R E P L I E S    (Newest First)
amorris Posted - 09/03/2006 : 1:09:20 PM
One more question: does anyone know where I can find information about the different formatting options that can be used with the substitution notation in labtalk? Searching the help files has gotten me nowhere...

Alexis

Edited by - amorris on 09/03/2006 1:09:58 PM
amorris Posted - 09/03/2006 : 12:55:20 PM
Hi Hideo Fujii,

Thank you a million times over for that little piece of advice! Hard coding file names with if statements isn't so bad if there is just one variable which might equal 0, but if you have 2 or more, it gets quite messy. Thanks again,

Alexis
Hideo Fujii Posted - 09/01/2006 : 12:26:56 PM
Hi Alexis,

C format $(rot,%.3f) should work as below:

rot=0;
%k=$(rot,%.3f).dat;
%k=;
0.000.dat

rot=1;
%k=$(rot,%.3f).dat;
%k=;
1.000.dat

--Hideo
OriginLab

amorris Posted - 09/01/2006 : 11:32:39 AM
Hi Mike,

Thanks for the reply. I figured as much, but was hoping for a better way to do this (is this a labtalk bug?). At least now I know, and won't have to waste my time looking for something else! And yes, you are right, it should be $(rot,.3), I just made a mistake when parsing my question...

Cheers,

Alexis
Mike Buess Posted - 09/01/2006 : 09:17:07 AM
Hi Alexis,

Might be easiest to force the formatting for rot=0...

if( rot>0 ) %N=$(rot,.4).dat; // shouldn't it be .3?
else %N=0.000.dat;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/01/2006 09:23:58 AM

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