T O P I C R E V I E W |
vadb |
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
|
6 L A T E S T R E P L I E S (Newest First) |
vadb |
Posted - 10/31/2013 : 5:30:17 PM Thanks, Hideo! Both solutions work. |
greg |
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 |
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). |
Hideo Fujii |
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 |
vadb |
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 |
Posted - 10/31/2013 : 4:15:42 PM Hi vadb,
You can use the value(...) function to convert a string to a number such as:value(Mid(col(3)$,9,2)$) See the detail at: http://wikis/ltwiki/index.php?title=LabTalk%3AValue_%28function%29
Does it work in your situation?
--Hideo Fujii OriginLab
|