| T O P I C R E V I E W |
| peter.cook |
Posted - 11/07/2003 : 05:43:35 AM Hi,
recently noticed that there is an inconsistency in the (format of) values returned from nyumeric variables.
Examples :
pete=n; n=
pete=0.001 returns pete=1e-3 pete=0.00101 returns pete=0.00101 pete=0.002 returns pete =0.002 pete=0.00201 returns pete=0.00201 pete=0.0002 returns pete=2e-4
This is a problem as I would like to run code like the following :
[u]loop(numcol,1,%H!wks.ncols) { loop(numrow,1,numrows) { %T=%(%H,numcol,numrow); %(NewSheet,numcol,numrow)=%T; }; };
for simplicity.
The issue is copying from and to mixed format worksheets ('numeric and text' and 'text' data). Any help appreciated.
Cheers,
Pete
|
| 1 L A T E S T R E P L I E S (Newest First) |
| greg |
Posted - 11/07/2003 : 10:20:24 AM There are two parts here: Your first examples only demonstrate that Origin has options to auto-display values above or below specified magnitudes in standard or scientific notation. In the examples, all numbers less than or equal to .001 display in scientific notation - which means you are using the default Tools : Options : [Numeric Format] : "Lower Threshold Power" of -3. In all your cases, the real values and the displayed values are mathematically equivalent. There could be a case where the real value differs mathematically from the displayed value. For example, enter 0.999999999 into a cell and (by the defaults controlling the display format) you will see 1 : an 'error' of .000000001.
There can, therefore be a problem if you put the display form of numeric data into a text column : you will lose some precision.
I think an older version of Origin used to exhibit this problem when using %(worksheet,column,row) notation, but it was fixed, and - in addition - we added the cell(row,column) notation which can do text or numeric.
So you should be aware of differences in script handling of data formats, and you should code to handle those differences. In a worst case scenario - mixed text and numbers - you might have to do some creative programming, such as:
loop(numrow,1,numrows) { %T=%(%H,numcol,numrow); if($(%T)==0/0) NewSheet!cell(numrow,numcol)$= %T; else NewSheet!cell(numrow,numcol)=%T; };
Note that the %(worksheet,column,row) notation does not allow for string assignment, so I used the worksheet!cell() function which can do either text or numeric. Also - a warning - I've forgotten which service release of which version introduced the cell() function, but it was initially defined as cell(numcol,numrow).
|
|
|