※ 引述《rocken (none)》之銘言:
> 如題
> command是一個字串,如何將它轉成變數的名稱
用 eval
str='command';
a=rand(10,10);
cmd=[str '=a;']; %cmd is a string ==> 'command=a;'
eval(cmd); %command 變成一個與a相同的變數名稱
--
===== < http://www.terasoft.com.tw > =====
鈦思科技股份有限公司--技術服務中心
Terasoft Inc., tel:(02) 277-83083
fax:(02) 277-83183
===== < [email protected] > ========
--
※ Origin: 楓橋驛站<bbs.cs.nthu.edu.tw> ◆ From: bbs.es.ncku.edu.tw