Solo Predictor Script Commands Summary: Difference between revisions
imported>Jeremy |
|||
(12 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
==Import of data into object== | |||
obj = 'filename.ext' | obj = 'filename.ext' | ||
obj = 'fully/qualified/path/filename.ext' | obj = 'C:/fully/qualified/path/filename.ext' | ||
obj = '//fully/qualified/path/filename.ext' | |||
obj = 'filename.mat?variable' | obj = 'filename.mat?variable' | ||
obj = '<xml>(PLS_Toolbox XML Format)</xml>' | obj = '<xml>(PLS_Toolbox XML Format)</xml>' | ||
obj = '3,4,5' | obj = '3,4,5' | ||
obj = '"string"' | |||
See [[Solo_Predictor_Script_Construction#Importing_Commands|Script Construction Importing Commands]] for more details. | |||
==Apply one object to another== | |||
*Apply a model object to a data object: | *Apply a model object to a data object: | ||
Line 17: | Line 21: | ||
Fields in "result" will depend on the model and object types. | Fields in "result" will depend on the model and object types. | ||
See [[Solo_Predictor_Script_Construction#Application_of_Models_and_Preprocessing_Commands|Application of Models and Preprocessing Commands]] for more details. | |||
Return value of object or property of object: | ==Retrieving Results== | ||
====Return request command==== | |||
Return value of object or property of object in returned string: | |||
obj | obj | ||
obj.property | obj.property | ||
===Output Format commands:=== | See [[Solo_Predictor_Script_Construction#Requesting_Return_Values|Requesting Return Values]] for more details. | ||
====Output Format commands:==== | |||
Configure the format of output strings | |||
:xml -set output format to XML | :xml -set output format to XML | ||
:plain -set output format to plain text | :plain -set output format to plain text | ||
:html -set output format to HTML | :html -set output format to HTML | ||
:json -set output format to JSON | |||
See [[Solo_Predictor_Script_Construction#Response_Message_Format|Response Message Format]] for more details. | |||
===Write To File command=== | |||
Create output file using a template file for formatting | Create output file using a template file for formatting | ||
:writefile 'output.ext' 'template.tem' –append | :writefile 'output.ext' 'template.tem' –append | ||
Line 39: | Line 55: | ||
Note that the template file '''must''' have the .tem extension. | Note that the template file '''must''' have the .tem extension. | ||
===Other Commands== | '''Note:''' Requires the ''writefilefolder'' configuration property to be assigned. | ||
See [[Solo_Predictor_Script_Construction#Write_To_File_Command|Write To File Command]] for more details. | |||
===Export command=== | |||
Export any object to a file using: | |||
:export 'output.ext' object | |||
extension on output filename 'output.ext' must be one of the following: | |||
:'''.xml''' = Creates an XML encoding of the object | |||
:'''.mat''' = Creates a MAT file containing the object | |||
:'''.m''' = Creates an m-file encoding of the object (Matlab m-code which, when executed, will recreate the object) | |||
:'''.csv''' = Creates a CSV encoding of the object (only valid for dataset objects or numeric arrays) | |||
:'''.smat''' = Creates an SMAT file containing the object (only available if secureMAT file feature is installed) | |||
'''Note:''' Requires the ''writefilefolder'' configuration property to be assigned. | |||
See [[Solo_Predictor_Script_Construction#Export_command|Export Command]] for more details. | |||
==Working with Advanced Objects== | |||
===Create new object=== | |||
obj = @dataset([3,4,5]) | |||
obj = @evriscript('modulename') | |||
obj = @evrigui('analysis') | |||
===Modify object=== | |||
import commands can also be applied to object properties: | |||
obj.property = '3,4,5' | |||
obj.property = 'fully/qualified/path/filename.ext' | |||
obj.property = '<xml>(PLS_Toolbox XML Format)</xml>' | |||
obj.property = '"string value"' | |||
==Other Commands== | |||
:include 'myscript.txt' | :include 'myscript.txt' | ||
Executes the script in myscript.txt. | Executes the script in myscript.txt. | ||
Included scripts are executed at the point in the calling script where the include statement occurs. If any errors happen during myscript.txt, all script execution will stop at the include statement. Commands after the include can use objects created within the script (included scripts share the same workspace). | Included scripts are executed at the point in the calling script where the include statement occurs. If any errors happen during myscript.txt, all script execution will stop at the include statement. Commands after the include can use objects created within the script (included scripts share the same workspace). | ||
:list Returns list of current objects | :list Returns list of current objects | ||
:clear Clears all objects | :clear Clears all objects | ||
:version Returns product version and system information | |||
:versionshort Returns just product and version number | |||
===Comments=== | ===Comments=== | ||
//Comment; | //Comment; | ||
#Comment; | |||
%Comment; | %Comment; | ||
Any text following one of the comment characters shown above (and before any end-of-line character) is ignored. This allows users to include comments into their scripts to make them more human-readable. | Any text following one of the comment characters shown above (and before any end-of-line character) is ignored. This allows users to include comments into their scripts to make them more human-readable. |
Latest revision as of 10:22, 3 January 2023
Import of data into object
obj = 'filename.ext' obj = 'C:/fully/qualified/path/filename.ext' obj = '//fully/qualified/path/filename.ext' obj = 'filename.mat?variable' obj = '<xml>(PLS_Toolbox XML Format)</xml>' obj = '3,4,5' obj = '"string"'
See Script Construction Importing Commands for more details.
Apply one object to another
- Apply a model object to a data object:
result = data|model
- Apply a preprocessing object to a data object:
result = data|preprocessing
- Augment two data objects together:
result = data_1|data_2
Fields in "result" will depend on the model and object types.
See Application of Models and Preprocessing Commands for more details.
Retrieving Results
Return request command
Return value of object or property of object in returned string:
obj obj.property
See Requesting Return Values for more details.
Output Format commands:
Configure the format of output strings
:xml -set output format to XML :plain -set output format to plain text :html -set output format to HTML :json -set output format to JSON
See Response Message Format for more details.
Write To File command
Create output file using a template file for formatting
:writefile 'output.ext' 'template.tem' –append
Optional flag "-append" will append to end of output.ext instead of replacing the file. If 'template.tem' filename is omitted, a template file named 'output.tem' is expected in the same folder as the output file.
The Template file can contain static text and replacement fields using square brackets around return-request-style codes, for example:
"the T-squared value is [pred.t2]"
replacement fields can also contain a formatting code using standard fprintf formatting:
"the Q value is [%0.2e,pred.q]"
Note that the template file must have the .tem extension.
Note: Requires the writefilefolder configuration property to be assigned.
See Write To File Command for more details.
Export command
Export any object to a file using:
:export 'output.ext' object
extension on output filename 'output.ext' must be one of the following:
- .xml = Creates an XML encoding of the object
- .mat = Creates a MAT file containing the object
- .m = Creates an m-file encoding of the object (Matlab m-code which, when executed, will recreate the object)
- .csv = Creates a CSV encoding of the object (only valid for dataset objects or numeric arrays)
- .smat = Creates an SMAT file containing the object (only available if secureMAT file feature is installed)
Note: Requires the writefilefolder configuration property to be assigned.
See Export Command for more details.
Working with Advanced Objects
Create new object
obj = @dataset([3,4,5]) obj = @evriscript('modulename') obj = @evrigui('analysis')
Modify object
import commands can also be applied to object properties:
obj.property = '3,4,5' obj.property = 'fully/qualified/path/filename.ext' obj.property = '<xml>(PLS_Toolbox XML Format)</xml>' obj.property = '"string value"'
Other Commands
:include 'myscript.txt'
Executes the script in myscript.txt.
Included scripts are executed at the point in the calling script where the include statement occurs. If any errors happen during myscript.txt, all script execution will stop at the include statement. Commands after the include can use objects created within the script (included scripts share the same workspace).
:list Returns list of current objects :clear Clears all objects :version Returns product version and system information :versionshort Returns just product and version number
Comments
//Comment; #Comment; %Comment;
Any text following one of the comment characters shown above (and before any end-of-line character) is ignored. This allows users to include comments into their scripts to make them more human-readable.