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
 processing string for formula output
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

maric001

Germany
5 Posts

Posted - 11/25/2014 :  11:34:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

lkb0221

China
497 Posts

Posted - 11/26/2014 :  09:30:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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