units¶
units returns the unit converter object.
- oUnit = units()
Return Value
Units-Converter-Objekt or the value 0, if the object could not be created.
Comment
When called for the first time, the given Excel file is read and the data is saved in an XML file in the user directory. The file name is units.xml.
The Excel file name can be set in the Tools=>Formula Configuration dialog
box. The file name is saved in the registry in the key
Settings\unit-converter-file
, see also UniPlot’s Use of the Windows Registry.
WriteProfileString("Settings", "unit-converter-file", ...
GetRootDirectory() + "Template/units.xlsx");
If you need to add other units or alias values copy the default file into a new directory and add the new units. Open the Tools=>Formula Configuration dialog to specify the new file.
Or use the UniPlot command window to set up the new Excel file.
s = GetUserDirectory() + "Template/units.xlsx"
WriteProfileString("Settings", "unit-converter-file", s);
The active units file can be opened with the following command:
ShellExecute(units().excel_file)
Example
u = units();
rvScale = units_get_scale(u, "HP", "PS")
rvScale
1.0139 0.0000
rvScale = u.scale("HP", "PS")
rvScale
1.0139 0.0000
History
Version |
Description |
---|---|
R2017.6 |
The default units file units.xls has been converted to units.xlsx. The XLS file had problems with some ANSI characters. |
R2013.11 |
New. |
See also
id-680445