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
 Origin Forum
 decimal numbers in label
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

pretep

Germany
3 Posts

Posted - 01/05/2005 :  02:19:59 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Go to Top of Page

Mike

USA
357 Posts

Posted - 01/05/2005 :  11:25:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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:
  1. Create a variable called "myvar" and assign it some value
  2. Create a text label that reads "$(myvar, .2)"
  3. 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
Go to Top of Page

pretep

Germany
3 Posts

Posted - 01/06/2005 :  03:08:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

greg

USA
1379 Posts

Posted - 01/06/2005 :  11:23:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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"

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/06/2005 :  1:05:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

pretep

Germany
3 Posts

Posted - 01/07/2005 :  12:26:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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