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 ...
随机推荐
- 笔记-django- HttpRequest/Response
笔记-django- HttpRequest/Response 1. HttpRequest/Response When a page is requested, Django create ...
- 20145207《网络对抗》MAL后门原理与实践
20145207<网络对抗>MAL后门原理与实践 基础问题回答 (1)例举一个后门进入到你系统中的可能方式? 下载软件,淘宝虚假链接,买卖账号时侵入的黑客 (2)例举一个后门启动起来(wi ...
- 北京Uber优步司机奖励政策(10月5日~10月11日)
用户组:优步北京人民优步A组(适用于10月5日-10月11日) 滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/ ...
- 厦门Uber优步司机奖励政策(12月21日-12.27日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- CF 314 E. Sereja and Squares
E. Sereja and Squares http://codeforces.com/contest/314/problem/E 题意: 给你一个擦去了部分左括号和全部右括号的括号序列,括号有25种 ...
- HTML+JS = 网站注册界面源代码
本注册页面未设置编码方式和兼容性,已测试,在Chrome浏览器显示正常 <!DOCTYPE html> <html> <head> <title>注册页 ...
- leetcode-最长上升子序列LIS
转载原文地址:http://www.cnblogs.com/GodA/p/5180560.html 给定一个无序的整数数组,找到其中最长上升子序列的长度. 示例: 输入: [10,9,2,5,3,7, ...
- [Clr via C#读书笔记]Cp19可空值类型
Cp19可空值类型 主要解决的是和数据库中null对应的问题: System.Nullable结构:值类型: int?语法: 可空实例能够使用操作符: C#空合并操作符??; 即可用于引用类型,也可以 ...
- Linux的基础预备知识
Linux下一切皆文件 1.root@mk-virtual-machine:/home/mk# root:该位置表示当前终端登录的用户名 mk-virtual-machine:/home/m ...
- metamask注记词
leaf orbit poet zebra toy day put dinosaur review cool pluck throw(m) 一个钱包地址 里面有多个账号 菲苾代表了不同网络