Author |
Topic |
|
vadb
9 Posts |
Posted - 10/31/2013 : 3:36:48 PM
|
I am trying to set the values of a column based on string parameters in a another column. For instance, in column 3 I have strings such as: dt=50_dx=100
In column 1, I would like to extract the values of dt, so I have the following in the "set column values" field: Mid(wcol(3),9,2)$
However, this only extracts the string. How do I convert this to a number? Is there anything like excel's value() function?
Thank you in advance! Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.0.0 (64-bit) SR2 Operating System: Win7 x64
|
|
Hideo Fujii
USA
1582 Posts |
|
vadb
9 Posts |
Posted - 10/31/2013 : 4:39:49 PM
|
Hi Hideo,
I tried your suggestion but the resulting values in the calculated column are still strings... |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 10/31/2013 : 4:43:48 PM
|
Hi,
Sorry! Value( ) function works in version 9.1, and seems it was not implemented in 9.0. As a work-around, after extracting the strings, you can change the column's format to "Numeric" from the default "Text & Numeric".
--Hideo Fujii OriginLab |
Edited by - Hideo Fujii on 10/31/2013 4:52:02 PM |
|
|
vadb
9 Posts |
Posted - 10/31/2013 : 4:50:23 PM
|
Hi Hideo,
I was actually referring to the value() suggestion not working (I didn't see your other link until now). |
|
|
greg
USA
1378 Posts |
Posted - 10/31/2013 : 5:03:34 PM
|
value( ) is a new function in 9.1.
Use this in the Before Formula Scripts section in older versions of Origin:
range rai = col(3); range rao = col(extract); loop(ii,1,rai.GetSize()) { str$ = mid(rai[ii]$,4,2)$; rao[ii] = %(str$); } |
|
|
vadb
9 Posts |
Posted - 10/31/2013 : 5:30:17 PM
|
Thanks, Hideo! Both solutions work. |
|
|
|
Topic |
|