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
processing string for formula output
Note:
You must be registered in order to post a reply.
To register,
click here
. Registration is FREE!
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
[quote][i]Originally posted by maric001[/i] [br]Origin Ver. and Service Release (Select Help-->About Origin): 9.1 Operating System: win7 64 Hi there, i am building up a formula from my origin project: win -o Formeln { page.active=2; loop(ss,1,wks.maxRows){ string Ref$=Col(2)[$(ss)]$; string Sig$=Col(3)[$(ss)]$; string RefIK$=Col(4)[$(ss)]$; string SigIK$=Col(5)[$(ss)]$; string RefITK$=Col(6)[$(ss)]$; string SigITK$=Col(7)[$(ss)]$; string RefMTK$=Col(8)[$(ss)]$; string SigMTK$=Col(9)[$(ss)]$; [Formeln]1!Col(2)[$(ss)]$="(((("+Sig$+"-"+SigIK$+")/("+Ref$+"-"+RefIK$+")"+"-"+SigITK$+")/(T1-"+RefITK$+")*1000000-"+SigMTK$+")/(T3-"+RefMTK$+")*1000"; }}; The script works so far, but since my data can contain negative values, i am ending up with something like this: ((((W66--10085,62259)/(W60--1545,35772)-2,37845)/(T1--55430,60782)*1000000--1,40652)/(T3-31328,2108)*1000 How to replace the double minus "--" with a single plus? Cheers Markus [/quote]
Check here to include your profile signature.
Check here to subscribe to this topic.
T O P I C R E V I E W
maric001
Posted - 11/25/2014 : 11:34:23 AM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1
Operating System: win7 64
Hi there,
i am building up a formula from my origin project:
win -o Formeln {
page.active=2;
loop(ss,1,wks.maxRows){
string Ref$=Col(2)[$(ss)]$;
string Sig$=Col(3)[$(ss)]$;
string RefIK$=Col(4)[$(ss)]$;
string SigIK$=Col(5)[$(ss)]$;
string RefITK$=Col(6)[$(ss)]$;
string SigITK$=Col(7)[$(ss)]$;
string RefMTK$=Col(8)[$(ss)]$;
string SigMTK$=Col(9)[$(ss)]$;
[Formeln]1!Col(2)[$(ss)]$="(((("+Sig$+"-"+SigIK$+")/("+Ref$+"-"+RefIK$+")"+"-"+SigITK$+")/(T1-"+RefITK$+")*1000000-"+SigMTK$+")/(T3-"+RefMTK$+")*1000";
}};
The script works so far, but since my data can contain negative values, i am ending up with something like this:
((((W66--10085,62259)/(W60--1545,35772)-2,37845)/(T1--55430,60782)*1000000--1,40652)/(T3-31328,2108)*1000
How to replace the double minus "--" with a single plus?
Cheers
Markus
1 L A T E S T R E P L I E S (Newest First)
lkb0221
Posted - 11/26/2014 : 09:30:52 AM
Hi, Markus
Modify the loop as following:
// Start
// ...
string SigMTK$=Col(9)[$(ss)]$;
string Result$ = "(((("+Sig$+"-"+SigIK$+")/("+Ref$+"-"+RefIK$+")"+"-"+SigITK$+")/(T1-"+RefITK$+")*1000000-"+SigMTK$+")/(T3-"+RefMTK$+")*1000";
int nRet = Result.Replace("--", "-");
[Formeln]1!Col(2)[$(ss)]$ = Result$;
// ...
// End
The str.Replace will replace all "--" by "-".
Zheng
OriginLab
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000