eval在MATLAB和Shell中的作用
2016-01-03 16:39
579 查看
首先来看eval在Matlab中的定义:
Execute MATLAB expression in text string.
Syntax
eval(expression) evaluates the MATLAB code in the string expression. If you use eval within an anonymous function, nested function, or function that contains a nested function, the evaluated expression cannot create a variable.
简单来说eval()函数的功能就是在字符串中执行MATLAB的表达式。
举个例子:
我们再来看eval在Shell中的作用。
《Shell脚本学习指南》中写道:eval语句是在告知Shell取出eval的参数,并再执行它们一次,使它们经过整个命令行的处理步骤。
我们看一个例子:
Execute MATLAB expression in text string.
Syntax
eval(expression) evaluates the MATLAB code in the string expression. If you use eval within an anonymous function, nested function, or function that contains a nested function, the evaluated expression cannot create a variable.
简单来说eval()函数的功能就是在字符串中执行MATLAB的表达式。
举个例子:
>> a=1:5 >> b='a.^2' >> eval(b) ans = 1 4 9 16 25
我们再来看eval在Shell中的作用。
《Shell脚本学习指南》中写道:eval语句是在告知Shell取出eval的参数,并再执行它们一次,使它们经过整个命令行的处理步骤。
我们看一个例子:
listpage="ls | more" $listpage
相关文章推荐
- 编写你的shell其实很简单
- Window下使用Xshell连接VirtualBox中CentOS SSH最佳实践
- sed使用方法
- awk用法三
- awk用法二
- chapter11:认识与学习bash之(4)管道命令
- chapter11:认识与学习bash之(3)数据流重定向
- 如何把root登陆的shell改为csh?
- Xshell无法连接虚拟机Linux
- Shell编程实战 1.1 监控思路架构介绍
- How to use “svn add” recursively in Linux shell?
- Linux Shell 1>/dev/null 2>&1 &
- 写你的shell,其实很简单[架构篇]
- msf生成shellcode
- Shell编程进阶 2.2 shell数组
- 编写你的shell其实很简单
- Shell编程进阶 2.1 shell函数
- Shell编程进阶 2.0 shell中断继续退出
- Centos7 基本shell命令
- 嵌入式考试Shell编程题