supertext

バージョン 1.0.0 (3.59 KB) 作成者: Robert Rasche
easy fstring-like text templates inside mfiles
ダウンロード: 2
更新 2022/8/30

ライセンスの表示

SUPERTEXT returns the text of the first comment block following the call. The block comment delimiters, %{ and %}, must appear on lines by themselves (optionally preceded by white space).
Essentially this provides "heredoc"-capability combined with python-style fstrings to the MATLAB language.
If you want a final end-of-line character then leave a blank line before the %}.
If both comment delimiters are preceded by the same white space (same combination of spaces and tabs) then that white space will be deleted (if possible) from the beginning of each line of the commented text. This is so the whole block can be indented.
Example,
some_variable = 'my custom text'
str = supertext
%{
text is simply returned
{some_variable} that will be inserted by supertext.
{repmat('bla', 1, 3)} will be evaluated and placed in line
%}
SUPERTEXT can be used in an m-file, where it needs to precede a multiline comment or on it's own, when you pass the name of a file containing the template text.

引用

Robert Rasche (2024). supertext (https://www.mathworks.com/matlabcentral/fileexchange/116895-supertext), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2022a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
謝辞

ヒントを得たファイル: verbatim: Get the text of a block comment.

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0