Main Content

saveFixedWingToScript

Class: Aero.FixedWing
Namespace: Aero

Save FixedWing aircraft definition to MATLAB script

Since R2024b

Syntax

savedName = saveFixedWingToScript(aircraft,filename)
savedName = saveFixedWingToScript(___,varname)
savedName = saveFixedWingToScript(___,Name=Value)

Description

savedName = saveFixedWingToScript(aircraft,filename) saves the FixedWing object aircraft to a MATLAB® script file, filename. The function overwrites existing files named filename.

savedName = saveFixedWingToScript(___,varname) saves the FixedWing object aircraft to the variable specified by varname instead of aircraft to a script file, filename.

savedName = saveFixedWingToScript(___,Name=Value) saves a FixedWing object with additional options. Specify Name=Value as the last combination of arguments preceded by any of the input argument combinations in the previous syntaxes.

Input Arguments

expand all

Aero.FixedWing aircraft object, specified as a scalar string or an empty Aero.FixedWing aircraft object.

To create an empty aircraft, use aircraft=Aero.FixedWing(0).

Example: MyAircraft

MATLAB script into which to write the FixedWing aircraft object definition, specified as a scalar string.

  • If a file named filename already exists, the function overwrites it with the new one.

  • The filename cannot match the name of any variable in the current workspace.

  • The filename can optionally include the suffix .m.

Example: MyAircraftScript.m

Data Types: string

Variable to which to save the FixedWing aircraft object, specified as a scalar variable name. By default, the function generates a script that, when run, reconstructs the FixedWing object to a variable called aircraft. Specifying varname changes the variable name in the script to varname.

Example: NewAircraft

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: MaximumTextWidth=33

Maximum width of text wrap, specified as an integer between 32 and 256.

Example: MaximumTextWidth=33

Data Types: double

Script save mode, specified as one of these values:

  • create — Save variables to a new MATLAB script. The function overwrites the existing file.

  • update — Update only the variables that already exist in filename.

  • append — Update only the variables that already exist in filename and append new variables to the end of the script.

Example: SaveMode=update

Data Types: char | string

Output Arguments

expand all

Name of the saved variable in the MATLAB script. If the FixedWing is saved to a MAT file, savedName is an empty string "".

Examples

expand all

Create a FixedWing aircraft object with an elevator surface and save it to a MATLAB® script, myFileName.m.

Create a FixedWing aircraft object, elevator, with an elevator surface.

elevator = fixedWingSurface("elevator","on","Symmetric",[-20, 20]);
aircraft = fixedWingAircraft("MyAircraft",3,2,1);
aircraft.Surfaces = elevator;

To save the aircraft object to a MATLAB script, myFileName, call the saveFixedWingToScript method for aircraft.

savedName = saveFixedWingToScript(aircraft,'myFileName')
savedName = 
"aircraft"

See the contents of myFileName.

edit myFileName

Version History

Introduced in R2024b

See Also

Classes