Bli*_*yir 2 matlab
我如何将x ='abs'转换为abs以便我可以执行z = abs(-5)= 5.或者其中x ='randfunc'其中'randfunc'可以是与函数相关的任何输入字符串.
>> x x = abs >> x(-5) Subscript indices must either be real positive integers or logicals.
Oli*_*rth 7
用途str2func:
str2func
x = 'abs'; fh = str2func(x); fh(-5) % Prints 5
归档时间:
10 年,8 月 前
查看次数:
78 次
最近记录: