Q1:exist()函数在matlab中怎么用?求教大神~
exist name
等价于 r=exist(name) ,在程序里面这样更加实用
0 不存在则返回值
1 name 可以是变量名,如果存在,返回值
2 函数名、m 文件名,存在则返回值
3 mex 文件、dll 文件,存在则返回值
4 内嵌的函数,存在则返回值
5 p码文件 , 存在则返回值
6 目录,存在则返回值
7 路径,存在则返回值
8 Java class,存在则返回值
A = exist('name','kind')
name 可以是变量名,函数名、m 文件名、mex 文件、dll 文件、内嵌的函数、p码文件、目录、路径、Java class
kind可以是 :
builtin 内嵌函数
class Java class
dir 目录
file 文件或者目录
var 变量
应用举例
type = exist('plot') %说明当前目录下存在plot这个内嵌函数
type =
5
X=rand(1,1)
X =
0.9593
matabc
r=exist('X')
r =
1
r=exist('X','var')
r =
1
matabc
还有一个非常有用的,曾经在论坛讨论过
如何判定一个结构体为空
s = struct
s =
1x1 struct array with no fields.
size(s) %用size不好判定
ans =
1 1
matabc
length(s) %length也一样
ans =
1
r=exist('s.field') %用exist可以判定
r =
0
Q2:请教matlab的exist函数的用法
>> help exist
EXIST Check if variables or functions are defined.
EXIST('A') returns:
0 if A does not exist
1 if A is a variable in the workspace
2 if A is an M-file on MATLAB's search path.It also returns 2 when
A is the full pathname to a file or when A is the name of an
ordinary file on MATLAB's search path
3 if A is a MEX-file on MATLAB's search path
4 if A is a MDL-file on MATLAB's search path
5 if A is a built-in MATLAB function
6 if A is a P-file on MATLAB's search path
7 if A is a directory
8 if A is a Java class
>> exist('map')
ans =
7
7 if A is a directory
Q3:在通达信软件中:"如果不存在某个条件即返回"怎么用公式表示?
根据条件求不同的值.
用法:
IF(X,A,B)若X不为0则返回A,否则返回B
例如:IF(CLOSE>OPEN,HIGH,LOW)表示该周期收阳则返回最高值,否则返回最低值
Q4:通达信EXIST什么意思
是存在的意思,比如说:EXIST(C>MA(C,10),10);
这个意思就是在10天之内存在收盘价大于10日均线的情况。
Q5:通达信的AA1:=EVERY(VOL<=REF(VOL,1),3);如何更改才能在大智慧中使用...
是否一直满足条件。
用法:
ALL(X,N),统计N周期中是否一直都满足X条件,若N=0则从第一个有效值开始。
例如:ALL(CLOSE>OPEN,20)表示是否20周期内全部都收阳线。
----------------------------------------
AA1:=ALL(VOL<=REF(VOL,1),3);
Q6:请问通达信软件里的一个函数
这是逻辑函数,表示某种状态是否持续存在,存在返回A,不存在返回B,某种状态是根据你的需求设定,返回A或B是方便你识别。