Navigation: Scripting Reference Manual > Functions & Subroutines > WriteToPlotFileWithComment

 

WriteToPlotFileWithComment

 

Contact Us: fredsupport@photonengr.com

 

Description

Writes an array of data to a text file with given text comments.

 

Syntax

WriteToPlotFileWithComment fname, comnt, ana, data

 

Parameters

fname As String

The text file name.

 

comnt As String

Comment string.

 

ana As T_ANALYSIS

A T_ANALYSIS structure which defines the location and size in 3D space of the data in the array.

 

data() As Double

The array of data to be written to the file.

 

Remarks

This subroutine writes the data to a text file in the current working directory. Since the file format is the same as the format used by FRED's 3D charts, this subroutine provides a convenient means of using the scripting language to produce plot files directly viewable by FRED.  The file can also be easily imported into spreadsheet applications such as Microsoft Excel.

 

 

See Also

T_ANALYSIS

WriteToPlotFile

DisplayPlotFile

 

Example

This example illustrates the use of WriteToPlotFileWithComment. A common use for this command is as a companion to the Irradiance command.  That is, you can call the Irradiance command to compute irradiance data in a 2D array, and then call the WriteToPlotFileWithComment command to write the irradiance distribution to a file.

 

1.  Declare a T_ANALYSIS structure, an array to hold the irradiance values and a string for the file name.

2.  Assign a file name to the declared string.

3.  Use LoadAnalysis to populate the T_ANALYSIS structure based upon a predefined Analysis surface.

4.  Issue the Irradiance command to calculate the irradiance in the global coordinate system and place the result in the array irrad.

5.  Write the data from the array irrad to the text file "myirrad.txt".

 


 

'step 1
Dim ana As T_ANALYSIS
Dim irrad() As Double
Dim fname$,comnt$

fname="myirrad.txt"                                    'step 2
comnt="this data contains irradiance values"
LoadAnalysis 7,ana                                     'step 3
num = Irradiance ( 6, -1, ana, irrad )                 'step 4
WriteToPlotFileWithComment fname, comnt, ana, irrad    'step 5

 

 

 

 

 

Copyright © Photon Engineering, LLC