qc_build_script qc_script_console navigation bar

Table of Contents

qc_run_script

Downloads and runs a script executable on a target.

Syntax

qc_run_script -t target_uri script arguments ... % Run a script executable on the specified target, passing the given arguments
qc_run_script -t target_uri script               % Run a script executable on the specified target with no arguments
qc_run_script script arguments ...               % Run a script executable on the default target, passing the given arguments
qc_run_script script                             % Run a script executable on the default target with no arguments
    

Description

Runs the script executable on the target. Script executables are generated from a MATLAB script using the qc_build_script command. The name of the script executable must include the file extension e.g. myscript.rt-win64. Any arguments specified are passed as command-line arguments to the script executable.

If no target URI is specified then the default target URI is used for the script executable. This default is returned by the qc_get_target_uri function when passed the script executable name.

When used in the command format shown above, arguments are all interpreted as strings and should not include quotes. In function call format, the quotes would be required.

For example, two equivalent commands are:

qc_run_script myscript.rt-win64 -kp 7.3

and

qc_run_script('myscript.rt-win64', '-kp', '7.3')

To pass a variable value as an argument use the functional form and convert the value to a string. For example:

qc_run_script('myscript.rt-win64', '-kp', num2str(gain))

If the variable gain were a vector, the same line above could be used as vectors are passed as the individual elements separated by spaces.

Parameters

target_uri

A string indicating the target URI. eg. tcpip://localhost:17000

script

The name of the script executable to run, including extension e.g. myscript.rt-win64

arguments

The arguments to pass to the script executable when it is run. To pass a string containing spaces enclose it in double quotes. Vectors are passed as a series of elements separated by spaces.

Outputs

This function has no outputs.

Examples

qc_run_script myscript.rt-win64                       % Runs myscript.rt-win64 on the default target with no arguments
qc_run_script controller.rt-win64 -kp 7.3 -kd 0.3     % Runs controller.rt-win64 on the default target, passing new controller gains as arguments
qc_run_script controller.rt-win64 -gains 7.1 0.4 0.05 % Runs controller.rt-win64 and passes a vector of gains
qc_run_script messenger.rt-win64 -msg "Hello world!"  % Runs messenger.rt-win64 and passes a string containing spaces
    

See Also

 

navigation bar