計算結果などから得られた数値を含んだ変数名を定義できますか?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 25 Oct 2013
Réponse apportée : MathWorks Support Team
le 25 Oct 2013
計算結果などから得られた数値を含めた変数名を定義する方法を教えてください。
例えば、
h=figure;
でfigure ウィンドウを新規作成した際に得られた figure のハンドル h に対して、
h=1 の場合はsample_1= …
h=2 の場合はsample_2= …
h=n の場合はsample_n= …
のように変数名を定義したいです。
Réponse acceptée
MathWorks Support Team
le 25 Oct 2013
NUM2STR 関数と EVAL 関数を使えば、計算した数値を含めた変数名を定義することが可能です。
・ サンプルコード
h=figure;
eval(['sample_',num2str(h),'=rand(1)'])
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!