摘要:
A = [5;3;4;1;7;2][B, C] = sort(A, 'descend') A = 5 3 4 1 7 2 B = 7 5 4 3 2 1 C = 5 1 3 2 6 4 C排序后对应的行号。 阅读全文
posted @ 2014-01-16 15:35
helloweworld
阅读(452)
评论(0)
推荐(0)
摘要:
save (FunctionNowFilename('test', '.mat' )); %----------------------filename: FunctionNowFilename.m ----------------------- function [ fname ] = FunctionNowFilename( pre, post )%NOW_FILENAME convert... 阅读全文
posted @ 2014-01-16 15:18
helloweworld
阅读(3041)
评论(1)
推荐(1)
摘要:
要设计的函数: 函数名:FunctionTest 输入:InputValueOne, InputValueTwo 输出:ReturnValueOne, ReturnValueTwo 在FunctionTest.m文件中编写如下代码: function [ReturnValueOne ReturnValueTwo] = FunctionTest(InputValueOne, InputValue... 阅读全文
posted @ 2014-01-16 15:15
helloweworld
阅读(1138)
评论(0)
推荐(0)
摘要:
ticfor i = 1:1:100endtoc 阅读全文
posted @ 2014-01-16 15:01
helloweworld
阅读(447)
评论(0)
推荐(0)
摘要:
矩阵最大值和对应的行列号 找最大元素就是max(max(A)),注意二维矩阵要写两个max 找对应位置用find函数 举个例子: >> A=[1 2 3 ;4 5 6] A = 1 2 3 4 5 6 >> max(max(A)) ans = 6 >> [x y]=find(A==max(max(A))) x = 2 y = 3 >> 找到最大元素是6,对应位置是x=2,y=3,就是第2行,第... 阅读全文
posted @ 2014-01-16 14:57
helloweworld
阅读(3327)
评论(0)
推荐(0)
摘要:
画柱状图 矩阵的一列为一组,每一行的颜色相同. %data %1 2%4 5%2 3data = [1,2;4,5;2,3];b = bar(data);ch = get(b,'children');set(gca,'XTickLabel',{'第一行','第二行','第三行'}); %横坐标每行的标号( 1 2、4 5、2 3三行)。legend('第一列','第二列'); 阅读全文
posted @ 2014-01-16 14:50
helloweworld
阅读(3187)
评论(0)
推荐(0)
摘要:
求矩阵A某行的和 A = [1,2,3;4,5,6;7,8,9]B=sum(A,2)B(2) A = 1 2 3 4 5 6 7 8 9 B = 6 15 24 ans = 15 阅读全文
posted @ 2014-01-16 14:47
helloweworld
阅读(1140)
评论(0)
推荐(0)
摘要:
求矩阵A每行的最大值和该最大值对应的列号 A = [22,1,3,0,2;11,23,43,55,5][maxA,col]=max(A');maxA'col' A = 22 1 3 0 2 11 23 43 55 5 ans = 22 55 ans = 1 4 阅读全文
posted @ 2014-01-16 14:46
helloweworld
阅读(2069)
评论(0)
推荐(0)
摘要:
取矩阵A的某一行 A = [22,1,3,0,2;11,23,43,55,5]A(2,:) A = 22 1 3 0 2 11 23 43 55 5 ans = 11 23 43 55 5 阅读全文
posted @ 2014-01-16 14:44
helloweworld
阅读(1587)
评论(0)
推荐(0)

浙公网安备 33010602011771号