Simple Configuration File Format for MATLAB

版本 0.3.0.0 (7.6 KB) 作者: Tamas Kis
Simple text-based file format for loading dictionary-like configuration data into MATLAB.
101.0 次下载
更新时间 2023/9/19

Simple Configuration File Format for MATLAB View Simple Configuration File Format for MATLAB on File Exchange Open in MATLAB Online

Simple text-based file format for loading dictionary-like configuration data into MATLAB.

The File Format

The simple config files are assumed to be ordinary text (.txt) files. The syntax of the files is designed to be very similar to the YAML syntax.

  • configuration data can be stored as key/value pairs, delimitted using a colon (:)
  • keys must be text
  • values can be text, numbers, booleans, lists of text, lists of numbers, and lists of booleans
    • lists are defined using square brackets ([ ])
    • list elements are delimited using commas (,)
    • booleans can be specified as false, False, true, or True
    • empty configs can be left blank (they are loaded in as empty arrays)
  • comments are started with the pound symbol (#)

NOTE: This simple config format does not support nested dictionaries.

Example

# satellite name
name: example satellite

# satellite properties
mass [kg]: 50
drag coefficient:
area of each face [m^2]: [2, 2, 3, 1.5, 5, 5]
label for each face: [face A, face B, face C, face D, face E, face F]

# control system settings
actuators active: false
sensors active: true

Loading a Simple Configuration File

A simple config file can be loaded into MATLAB using the load_config function.

Syntax

config = load_config(file_path)

Description

Inputs

  • file_path (char array or 1×1 string) relative or absolute file path (with or without file extension)

Outputs

  • config (1×1 dictionary (strings --> cell)) dictionary storing config data

Examples

  • See EXAMPLES.mlx or the "Examples" tab on the File Exchange page for examples.

引用格式

Tamas Kis (2024). Simple Configuration File Format for MATLAB (https://github.com/tamaskis/load_config-MATLAB/releases/tag/v0.3.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023a
与 R2022b 及更高版本兼容
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
0.3.0.0

See release notes for this release on GitHub: https://github.com/tamaskis/load_config-MATLAB/releases/tag/v0.3.0

0.2.1.0

See release notes for this release on GitHub: https://github.com/tamaskis/load_config-MATLAB/releases/tag/v0.2.1

0.2.0.0

See release notes for this release on GitHub: https://github.com/tamaskis/load_config-MATLAB/releases/tag/v0.2.0

0.1.1

See release notes for this release on GitHub: https://github.com/tamaskis/load_config-MATLAB/releases/tag/v0.1.1

0.1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库