Matlab函数
any() 相当于或操作,只要有1,就返回1
all() 相当于与操作,只要有0,就返回0
C = union(A,B):
C为A和B的并集。去掉相同元素。
C = intersect(A,B)
C为A和B的交集. The values of C are in sorted order.
[Lia,Locb] = ismember(A,B):
判断A中元素是否为B中的子元素,如果不是则,Lia和Locb中元素值都为0(注意,Lia大小和A一样,Locb大小和B一样)。如果A中有元素是B中的,在Lia中对应返回值1,Locb, containing the highest index in B for each value in A that is a member of B. The output array, Locb, contains 0 wherever A is not a member of B.
[C,ia] = setdiff(A,B):
返回的C元素为在A中出现,但是没有在B中出现,ia为其索引值,满足C = A(ia)。
D = D(:)'; % ensure that D is a row vector
D(:)按列将矩阵变为列向量
reshape是根据原来的矩阵创造新的矩阵,repmat是将原来的矩阵复制多次,构成一个大矩阵。
>> A=magic(4)
A =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
B = reshape(A,...,[],...) calculates the length of the dimension represented by the placeholder [], such that the product of the dimensions equals prod(size(A)). The value of prod(size(A)) must be evenly divisible by the product of the specified dimensions. You can use only one occurrence of [].
>> reshape(A,[],2)
ans =
16 3
5 10
9 6
4 15
2 13
11 8
7 12
14 1
max(a),若a为向量,返回最大值,若a为矩阵,返回每列最大值作为一个向量。
C = max(A,B) returns an array the same size as A and B with the largest elements taken from A or B. The dimensions of A and B must match, or they may be scalar.
C = max(A,[],dim) returnsthe largest elements along the dimension of A specifiedby scalar dim. For example, max(A,[],1) producesthe maximum values along the first dimension of A.
[C,I] = max(...) finds the indices of the maximum values of A, and returns them in output vector I. If there are several identical maximum values, the index of the first one found is returned.
K>> c=magic(4)
c =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
K>> max(c) 等同于max(c,[],1)
ans =
16 14 15 13
K>> max(c,[],2)
ans =
16
11
12
15
K>> [m,n]=max(c,[],2)
m =
16
11
12
15
n =
1
2
4
3
find; sparse;full
[i,j,s] = find(S);
[m,n] = size(S);
S = sparse(i,j,s,m,n);
对于稀疏矩阵,i,j分别是不为零项的index,s是其值
So does this, if the last row and column have nonzero entries:
[i,j,s] = find(S);
S = sparse(i,j,s);
Matlab函数的更多相关文章
- WPF调用Matlab函数方法
有的时候用C#写图像处理方法,比较费事,不如Matlab简单,但是Matlab又做不出WPF那样的好看界面,怎么办呢. 今天正好我要实现这个功能,就顺便写个小例子,给需要的人做个借鉴. 想要用WPF调 ...
- matlab函数_连通区域
1. matlab函数bwareaopen──删除小面积对象格式:BW2 = bwareaopen(BW,P,conn)作用:删除二值图像BW中面积小于P的对象,默认情况下使用8邻域.算法:(1)De ...
- matlab函数bwareaopen的详解
matlab函数_连通区域 1. matlab函数bwareaopen──删除小面积对象格式:BW2 = bwareaopen(BW,P,conn)作用:删除二值图像BW中面积小于P的对象,默认情况下 ...
- java调用matlab函数
如何将实验结果在matlab中可视化呢,下面使用java语言编程,调用matlab中的函数: 本人安装的是Matlab7.11.0 (R2010a)和 Eclipse 4.2 : 1)首先设置环境变量 ...
- opencv通过dll调用matlab函数,图片作为参数
[blog 项目实战派]opencv通过dll调用matlab函数,图片作为参数 前文介绍了如何“csharp通过dll调用opencv函数,图片作为参数”.而在实 ...
- MATLAB 函数
MATLAB函数大全 1.常见 http://wenku.baidu.com/link?url=tPpwD7Ox_1sG-SQv_XdYszBAPY9LX_Zb_dde_5JeOiu7RwN_i14X ...
- matlab函数集锦
matlab函数集锦 matlab函数集锦ISFINITE(X), ISINF(X), or ISNAN(X)pwd 当前目录eval 执行matlab函数CONV2( ,'same') 卷积F ...
- C/C++下调用matlab函数操作说明
1.matlab的安装 连接:http://pan.baidu.com/s/1qXuF7aO 安装32位版本的matlab(在目录下bin文件夹中有两个文件夹,选择win32文件夹下的setup进行安 ...
- 3D Slicer中文教程(六)—调用matlab函数(MatlabBridge使用方法)
1.安装MatlabBridge插件 (1)在工具栏找到Extension,点击进入Extension Manager (2)找到MatlabBridge,安装 2.配置MATLAB环境 (1)在模块 ...
- C++调用matlab函数
C++与matlab混合编程——C++调用MATLAB函数 笔者最近在从事一个MFC相关的项目,要求将用Matlab实现的算法通过应用MFC制作成一个小应用.其中有一部分内容需要求一个多元函数的最值. ...
随机推荐
- MsgWaitForMultipleObjects_测试
1.个人感觉: 1.1.MSDN中(https://msdn.microsoft.com/en-us/library/ms684242.aspx),说: “ dwWakeMask [in] The i ...
- 力扣(LeetCode)476. 数字的补数
给定一个正整数,输出它的补数.补数是对该数的二进制表示取反. 注意: 给定的整数保证在32位带符号整数的范围内. 你可以假定二进制数不包含前导零位. 示例 1: 输入: 5 输出: 2 解释: 5的二 ...
- SQL service 中的 ”输入SQL命令窗口“ 打开了 “属性界面” 回到 ”输入SQL命令窗口“
输入SQL命令窗口点击上面的菜单栏中的 “窗口”
- JAVA基础知识总结:十三
测试用一个字符串常量创建一个字符串对象 1.获取这个字符串的长度 2.获取任意长度的子串 3.判断这个字符串是否为空 4.将这个字符串中的小写字母转化为大写字母 5.获取某个字符在字符串中第一次出现的 ...
- (10)进程---Manager数据共享
Manager 能够实现进程之间的数据共享(dict list),但是必须上锁来确保数据的准确性, 队列则可以实现进程之间数据通信 from multiprocessing import Proce ...
- Notepad++ 的资源管理器 右键菜单
以前装的版本,右键[Edit With Notepad++]都可以出来的. 最近安装的总是不行. 不知道是Windows的原因,还是新版本的原因. 网上也都是用workaround去解决的. 免费的东 ...
- 7.2内存管理-ARC
@0-简介 1编译器会自动在适当的地方插入适当的retain.release.autorelease语句 @1-ARC的判断原则 1只要还有一个强指针变量指向对象,对象就会保持在内存中 2强指针 ...
- clustering
搞了将近一年的单细胞,聚类也是自认为得心应手了,自信满满. 但是多半是跑软件,对聚类的深层次的思想不甚了了. Google了一下clustering,看了一篇文章,突然了解到了clustering的算 ...
- 基因/转录本/任意特征 表达定量工具之featureCounts使用方法 | 参数详解
featureCounts真的很厉害. 常见的参数(没什么好说的,毕竟是固定的): -a -o input_file1 -F -t -g -Q -T 关键是以下几个参数怎么设置: -f # Perfo ...
- java读取ACCESS数据库的简单示例
java读取ACCESS数据库的简单示例 虽然简单,对初学者来说,如果没有一段可以成功执行的代码供参考,还真难调试 先用ACCESS建一个数据库 DB1.MDB,里面有一表"table1&q ...