Post Reply 
Units
05-07-2018, 06:43 PM (This post was last modified: 09-17-2019 05:39 PM by Gene222.)
Post: #1
Units
Is there something that explains how to use "Units" with variables and programs? Can units be used in programs?

[Image: Units11png.png]
Find all posts by this user
Quote this message in a reply
05-07-2018, 08:13 PM (This post was last modified: 05-07-2018 08:15 PM by DrD.)
Post: #2
RE: Units
Aside from the user guide, maybe something in this quick program will be useful?

Code:

// Provide a real number value for square meters (without units)

EXPORT units
BEGIN
  LOCAL sqmtrs;
  INPUT(sqmtrs);
  sqmtrs:=sqmtrs * 1_m^2;  
  RETURN CONVERT(sqmtrs / 1_min, 1_ft^2 / 1_s);
END;
Find all posts by this user
Quote this message in a reply
05-07-2018, 08:35 PM
Post: #3
RE: Units
Thank you.
Find all posts by this user
Quote this message in a reply
05-07-2018, 09:13 PM
Post: #4
RE: Units
Click the [VARS] key, then the [Home] soft menu and click [Real] in the menu. These are all called Real variables. Numbers with units cannot be stored in them. I don't know why. It's just how the Prime works.

You can store numbers with units attached to them if they are User Variables. In your case, you successfully stored 2.3_m^2 into the User Variable 'a'. Other examples of User Variables are MPG, Travel, & bAnAnA.

In this case, I don't know why your conversion fails. Probably because the [STO >] command as a shortcut for converting units is extremely picky on how it's entered. Here are two examples that should convert your example successfully.

In your problem, type [Shift] [Units] [Tools] [ 1 ], recall the 0.50772... and type [ , ] [ 1 ] [Shift] [ _ ] [Shift] [Units] [Units (soft label)] [ 3 ] [ 5 ] [ / ] [Shift] [Units] [ 5 ] [ 7 ] [ENTER].

Or you can recall the 0.50772... and type [STO >] [Shift] [Units] [ H ] [ 6 ] [Enter].
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)