Truncate a Variable

User created GMAT Functions that enhance the GMAT experience. Feel free to add functions that can help the community.

Truncate a Variable

Postby space_egd » Tue Mar 09, 2010 4:51 pm

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
BeginScript;
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
Attachments
truncToDecPlace.gmf
(1.37 KiB) Downloaded 310 times
space_egd
 
Posts: 357
Joined: Sun Jun 08, 2008 9:02 pm
Location: MD

Return to User GMAT Functions

Who is online

Users browsing this forum: No registered users and 1 guest

cron