Rename workspace structure with cell

3 ビュー (過去 30 日間)
Jepil
Jepil 2019 年 3 月 26 日
編集済み: Stephen23 2019 年 3 月 27 日
I have a trainedModel, and I want to rename the model automaticaly by 'for'
trainedModel = struct('test', 'test')
responseNames = {'Force1', 'Force2', 'Force3', 'Force4'}
I want to change the name of structure to 'trainedModel_Force1' using reponseNames.
  2 件のコメント
Stephen23
Stephen23 2019 年 3 月 27 日
編集済み: Stephen23 2019 年 3 月 27 日
Dynamically defining or accessing variable names is one way that beginners force themselves into writing slow, complex, obfuscated, buggy, hard-to-debug code. Read this to know why:
Indexing is simple, neat, easy to debug, and very efficient (unlike what you are trying to do). You should use indexing into one array (numeric or cell or structure), or a table, or fieldnames of a structure, or any other simpler way to store your data.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by