matlab 使用笔记

来源:互联网 发布:防网络诈骗四格漫画 编辑:程序博客网 时间:2024/05/17 02:53

矩阵最大值位置

[m, ind]=max( a(:) )
[i,j]=ind2sub(size(a),ind) 


如何在MATLAB中统计数组中相同元素的个数

法一:假定要分析的矩阵为data,


x=data(:)
x=sort(x);
d=diff([x;max(x)+1]);
count = diff(find([1;d])) ;
y =[x(find(d)) count]


最后输出的y(1)为元素值,y(2)为所对应的元素值在此矩阵中的出现的次数




法二:


>> A = [1 3 5 3 1 5 3 1 1 3 5];
>> count = hist(A,unique(A))

count =


     4     4     3



cat(3,a,b)拼矩阵,permute交换维度



matlab 2016a, 在ubuntu 16.04里闪退

1,首先sudo apt-get install matlab-support, 要重命名so文件

2,启动的时候加上-softwareopengl

0 0
原创粉丝点击