計算結果などから得られた数値を含んだ変数名を定義できますか?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 25 Okt. 2013
Beantwortet: MathWorks Support Team
am 25 Okt. 2013
計算結果などから得られた数値を含めた変数名を定義する方法を教えてください。
例えば、
h=figure;
でfigure ウィンドウを新規作成した際に得られた figure のハンドル h に対して、
h=1 の場合はsample_1= …
h=2 の場合はsample_2= …
h=n の場合はsample_n= …
のように変数名を定義したいです。
Akzeptierte Antwort
MathWorks Support Team
am 25 Okt. 2013
NUM2STR 関数と EVAL 関数を使えば、計算した数値を含めた変数名を定義することが可能です。
・ サンプルコード
h=figure;
eval(['sample_',num2str(h),'=rand(1)'])
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!