Page 1 of 1

Truncate a Variable

PostPosted: Tue Mar 09, 2010 4:51 pm
by space_egd
GMAT Function name: truncToDecPlace.gmf
Summary: Truncates a numeric variable to the decimal place the user desires.
Latest Compatible Source code date: 12/23/2009
Depends on the following GMAT functions: none
Function inputs:
  1. Variable - number to be truncated
  2. Variable - decimal place to truncate to. (i.e. 0.001 is the third decimal place)
Function Outputs:
  1. Variable
Script Syntax:
Code: Select all
[out1] = truncToDecPlace(in1,in2)

Examples from calling script:
Code: Select all
% Object Creation
Create Variable in1 in2;
Create Variable out1;

% Begin Mission Sequence
EndScript; % Ensures start of mission sequence in main script

in1 = 456.213145;
in2 = 0.01; % output of function should be 456.21 when using this value

[out1] = truncToDecPlace(in1,in2); % Call GMAT Function