ismember matlab
ismember 判断A中的元素在B中有没有出现
LIA = ismember(A,B) for arrays A and B returns an array of the same size as A containing true where the elements of A are in B and false otherwise.
对于数组A合B,返回一个和A同样尺寸的数组,若A某位置的元素在B中出现,则LIA相应位置为true,否则为false
LIA = ismember(A,B,'rows') for matrices A and B with the same number of columns, returns a vector containing true where the rows of A are also rows of B and false otherwise.
对于具有同样列数的A和B,返回一个向量,行数和A相同,如果A的该行在B中出现,则LIA该行的值为1,如果A的该行在B中没有出现过,返回0
[LIA,LOCB] = ismember(A,B) also returns an array LOCB containing the highest absolute index in B for each element in A which is a member of B and 0 if there is no such index.
LOCB和数组A的大小一样,里面包含A中元素在B中出现的位置,最大绝对值位置,即如果B中有两个元素和A中某元素相同,那么就返回索引值最大的那个位置
[LIA,LOCB] = ismember(A,B,'rows') also returns a vector LOCB containing the highest absolute index in B for each row in A which is a member of B and 0 if there is no such index.
同上
In a future release, the behavior of ismember will change including:
- occurrence of indices in LOCB will switch from highest to lowest
- tighter restrictions on combinations of classes
In order to see what impact those changes will have on your code, use:
[LIA,LOCB] = ismember(A,B,'R2012a')
[LIA,LOCB] = ismember(A,B,'rows','R2012a')
If the changes in behavior adversely affect your code, you may preserve
the current behavior with:
[LIA,LOCB] = ismember(A,B,'legacy')
[LIA,LOCB] = ismember(A,B,'rows','legacy')
Examples:
a = [9 9 8 8 7 7 7 6 6 6 5 5 4 4 2 1 1 1]
b = [1 1 1 3 3 3 3 3 4 4 4 4 4 9 9 9]
[lia1,locb1] = ismember(a,b)
% returns
lia1 = [1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1]
locb1 = [16 16 0 0 0 0 0 0 0 0 0 0 13 13 0 3 3 3]
[lia2,locb2] = ismember(a,b,'R2012a')
% returns
lia2 = [1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1]
locb2 = [14 14 0 0 0 0 0 0 0 0 0 0 9 9 0 1 1 1]
[lia,locb] = ismember([1 NaN 2 3],[3 4 NaN 1])
% NaNs compare as not equal, so this returns
lia = [1 0 0 1], locb = [4 0 0 1]
Class support for inputs A and B, where A and B must be of the same
class unless stated otherwise:
- logical, char, all numeric classes (may combine with double arrays)
- cell arrays of strings (may combine with char arrays)
-- 'rows' option is not supported for cell arrays
- objects with methods SORT (SORTROWS for the 'rows' option), EQ and NE
-- including heterogeneous arrays derived from the same root class
ismember matlab的更多相关文章
- Matlab中ismember用法
>> a = magic(3) a = 8 1 6 3 5 7 4 9 2 >> ismember(a,3) ans = 0 0 0 1 0 0 0 0 0 >> ...
- matlab函数_连通区域
1. matlab函数bwareaopen──删除小面积对象格式:BW2 = bwareaopen(BW,P,conn)作用:删除二值图像BW中面积小于P的对象,默认情况下使用8邻域.算法:(1)De ...
- 蚁群算法求解旅行商问题(附c和matlab源代码)
前几天写了个模拟退火算法的程序,然后又陆陆续续看了很多群智能算法,发现很多旅行商问题都采用蚁群算法来求解,于是开始写蚁群算法的模板.网上关于蚁群算法的理论很多就不再这里赘述了,下面直接上代码和进行简单 ...
- MATLAB命令大全
一.常用对象操作:除了一般windows窗口的常用功能键外.1.!dir 可以查看当前工作目录的文件. !dir& 可以在dos状态下查看.2.who 可以查看当前工作空间变量名, whos ...
- matlab函数bwareaopen的详解
matlab函数_连通区域 1. matlab函数bwareaopen──删除小面积对象格式:BW2 = bwareaopen(BW,P,conn)作用:删除二值图像BW中面积小于P的对象,默认情况下 ...
- Matlab图像处理函数:regionprops
本篇文章为转载,仅为方便学术讨论所用,不用于商业用途.由于时间较久,原作者以及原始链接暂时无法找到,如有侵权以及其他任何事宜欢迎跟我联系,如有侵扰,在此提前表示歉意.----------------- ...
- MATLAB 编程风格指南及注意事项
MATLAB编程风格指南Richard Johnson 著Genial 译MATLAB 编程风格指南Richard JohnsonVersion 1.5,Oct. 2002版权: Datatool 所 ...
- MATLAB连通域标记函数
L = bwlabel(BW,n)返回一个和BW大小相同的L矩阵,包含了标记了BW中每个连通区域的类别标签,这些标签的值为1.2.num(连通区域的个数).n的值为4或8,表示是按4连通寻找区域,还是 ...
- MATLAB函数表(转自:http://bbs.06climate.com/forum.php?mod=viewthread&tid=16041&extra=page%3D4)
MATLAB函数表 4.1.1特殊变量与常数 ans 计算结果的变量名 computer 确定运行的计算机 eps 浮点相对精度 Inf 无穷大 I 虚数单位 inputname 输入参数名 NaN ...
随机推荐
- 类加载器 ClassLoder详解
一.类加载器定义 从作用的角度来认识类加载器:(根据API文档) 1.类加载器是一个负责加载类的对象,而ClassLoader是一个抽象类.类加载器将xxx.class文件加载到JVM,生成xxx的C ...
- 记一次 Android 客户端(CJYYKT)的逆向
主角: 描述: 湖南省教育局推的一款大学生 App,需要每个学生看完里面的一个课程的视频,共 8 章,每章 10 - 23 个视频(连续播放大约 24 小时),每个视频每隔不定时间就会弹出一个选择题答 ...
- Python:TypeError: 'range' object doesn't support item deletion
报错代码: dataIndex = range(m) del (dataIndex[randIndex]) 报错信息: 错误原因: python3 range返回的是range对象,不是数组对象 解决 ...
- 关于iOS和Android的安装包更新笔记
关于iOS和Android的安装包更新问题 1. Android更新apk 1)使用DownloadManager下载 2)使用HttpClient下载 apk的下载不能使用ssl,即不能使用http ...
- SpringCloud Eureka 服务注册与服务发现
一.Eureka简介 spring Cloud Netflix技术栈中,Eureka作为服务注册中心对整个微服务架构起着最核心的整合作用.有了服务发现与注册,你就不需要整天改服务调用的配置文件了,你只 ...
- 使用conlleval.pl对CRF测试结果进行评价的方法
基于CRF做命名实体识别系列 用CRF做命名实体识别(一) 用CRF做命名实体识别(二) 用CRF做命名实体识别(三) 评测 用CRF做完命名实体识别我们测试之后得到的结果就是预测的标签,并不能直接得 ...
- 关于mongodb的mapReduce
由于nodejs本身的限制,在程序中使用js进行大批量计算效率不高.而V8引擎自身对内存大小的限制(64位系统下1.4G),同样限制了数据规模. 因此,相对于从mongodb中抽出数据进行计算,在mo ...
- Qt-QML-ComboBox-自定义,实现状态表示,内容可以动态正价,使用ListModel
哎呀呀呀, 问:杀死一个程序员一个程序要需要进步? 答:改三次需求 我感觉我就要再这需求的变更中被杀死了.不管怎么说,总是要跟着需求走的的,客户才是第一么(要不是因为钱,我才不会了) 下面先上个效果 ...
- fiddler不经意的功能
捕获指定客户端的请求,直接食用 窗口分离,直接食用 Hide this column 隐藏此列Ensure all columns are visible 显示默认所有列Customize co ...
- Ext JS 6学习文档-第8章-主题和响应式设计
Ext JS 6学习文档-第8章-主题和响应式设计 主题和响应式设计 本章重点在 ExtJS 应用的主题和响应式设计.主要有以下几点内容: SASS 介绍和入门 主题 响应式设计 SASS 介绍和入门 ...