how to create num2str in a variable

14 ビュー (過去 30 日間)
H-M
H-M 2020 年 8 月 23 日
コメント済み: Stephen23 2020 年 8 月 23 日
Hello,
How can I write the left hand side's expresion using num2str instead of f2 to avoid changing them every time when I change the f2 to another value?
your help is apreciated.
f2=50;
X1_f2_Y1 = Z1p;
X2_f2_Y2 = Z2p;
X3_f2_Y3 = Z3p;
X4_f2_Y4 = Z4p;
and also how it works if these expresions are used in save command?
save('E:\myfiles\data.mat','X1_f2_Y1 = Z1p');

回答 (2 件)

Steven Lord
Steven Lord 2020 年 8 月 23 日
Can you do this? Yes.
Should you do this? Generally we recommend against it.

KSSV
KSSV 2020 年 8 月 23 日
編集済み: KSSV 2020 年 8 月 23 日
str = ['X',num2str(1),'_f',num2str(2),'_Y',num2str(1),' = Z1',num2str(1),'p']

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by