Author |
Topic  |
|
pretep
Germany
3 Posts |
Posted - 01/05/2005 : 02:19:59 AM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System: WINXP
Hi, is there a possibility of affecting the number of the decimal places in a label text? For example: Rounding-off or rounding-up a certain maximum value.
thanks PRetep ... still another healthy new year ... |
|
cpyang
USA
1406 Posts |
Posted - 01/05/2005 : 09:17:11 AM
|
That will depend on how the labels are constructed. If a linked variable, then just use notation as documented in LabTalk manual like $(myvar,.3) for 3 decimal places.
CP
|
 |
|
Mike
USA
357 Posts |
Posted - 01/05/2005 : 11:25:41 AM
|
pretep, there is no "number of decimals places" property for a text object. To do something like CP is suggesting, you would need to do this:- Create a variable called "myvar" and assign it some value
- Create a text label that reads "$(myvar, .2)"
- Link the text label to the value of the variable "myvar" (in the GUI, you do this by right clicking on the text label, selecting Label Control, then enabling the Link to Variables (%,$) checkbox)
In such a case, when the value of "myvar" changes, a window refresh produces a text label with the new value of myvar formatted to 2 decimal places. For more information on formatting of labels with LabTalk, look in the Programming Help file (Help:Programming) for topic = The $( ) Notation and C Formatting Conversion Specifications.
I hope that this helps.
Mike OriginLab |
 |
|
pretep
Germany
3 Posts |
Posted - 01/06/2005 : 03:08:57 AM
|
Thank you for the references. This will really help me, I think. A beautiful day to you. PRetep
But: How do I have to declare such a variable (e.g. to asign to an ascii-file at L13V4)? Is that a stupid question? Sorry, I'm an absolut beginner ...
Edited by - pretep on 01/06/2005 04:23:05 AM
Edited by - pretep on 01/06/2005 04:44:40 AM |
 |
|
greg
USA
1379 Posts |
Posted - 01/06/2005 : 11:23:47 AM
|
This script executed in the Script Window creates a variable named 'myvar' with a value of 1234.5678 and then creates a label named 'MyLabel' that displays the value of myvar to two decimal places :
myvar=1234.5678; label -s -sl -n MyLabel $(myvar,.2);
I don't know what you mean by: "to asign to an ascii-file at L13V4"
|
 |
|
cpyang
USA
1406 Posts |
Posted - 01/06/2005 : 1:05:46 PM
|
quote: I don't know what you mean by: "to asign to an ascii-file at L13V4"
I think he meant to insert a value from Cntrl-H dialog and use "Insert as Link" to add to a graph.
Once inserted, you may see
%(1,@W,L13V4$)
which is inserted as a string, but you can still convert that by changing it into
$(%(1,@W,L13V4$),.2)
CP
Edited by - cpyang on 01/06/2005 1:06:59 PM |
 |
|
pretep
Germany
3 Posts |
Posted - 01/07/2005 : 12:26:43 AM
|
Hi,
I'm very impressed by your answers. Cpyang: Special thanks to you. That's the solution. It's so easy but so difficult (for me). Thanks a lot again for all the helping information. That's it for the moment. Bye, have a nice day. PRetep
|
 |
|
|
Topic  |
|
|
|