Matlab程序中temp(ic)= [data id]= out(ir) = Data(ir,id);这三句看不懂 程
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 05:07:02
Matlab程序中temp(ic)= [data id]= out(ir) = Data(ir,id);这三句看不懂 程序为求Data每行出现最多的数
Data = [1 2 3 2 2;
4 3 1 5 4;
3 5 1 2 1;
3 3 1 1 3];
for ir = 1:size(Data,1)%行数
for ic = 1:size(Data,2)%列数
temp(ic) = size(find(Data(ir,:) == Data(ir,ic)),2);
end
[data id] = max(temp,[],2);
out(ir) = Data(ir,id);
end
out'
Data = [1 2 3 2 2;
4 3 1 5 4;
3 5 1 2 1;
3 3 1 1 3];
for ir = 1:size(Data,1)%行数
for ic = 1:size(Data,2)%列数
temp(ic) = size(find(Data(ir,:) == Data(ir,ic)),2);
end
[data id] = max(temp,[],2);
out(ir) = Data(ir,id);
end
out'
1、第一句:
temp(ic) = size(find(Data(ir,:) == Data(ir,ic)),2);
以ir=1,ic=2为例说明
>> Data(1,:)%第一行所有的数
ans =
1 2 3 2 2
>> Data(1,2)%第一行第二列的数
ans =
2
>> find(Data(1,:) == Data(1,2))%找出 “Data(1,:)中大小为Data(1,2)的数” 所在的列的序号
ans =
2 4 5
>> size(find(Data(1,:) == Data(1,2)),2)%计算 “Data(1,:)中大小为Data(1,2)的数” 的数目
ans =
3
2、第二句:
C = max(A,[],dim) returns
the largest elements along the dimension of A specified
by scalar dim.For example,max(A,[],1) produces
the maximum values along the first dimension (the rows) 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.
[data id] = max(temp,[],2);%求出temp每行最大的数data ,并返回该数的序号id
3、第三句
out(ir) = Data(ir,id); %ir为行数,id为出现最多次数的数所在的列
再问: 好的,理解的一半,亲再给我解释下[data id] = max(temp,[],2);这一句和out(ir) = Data(ir,id); 这一句好吗 谢谢了
再答: 已解答 2、第二句: C = max(A,[],dim) returns the largest elements along the dimension of A specified by scalar dim. For example, max(A,[],1) produces the maximum values along the first dimension (the rows) 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. [data id] = max(temp,[],2);%求出temp每行最大的数data ,并返回该数的序号id 3、第三句 out(ir) = Data(ir,id); %ir为行数,id为出现最多次数的数所在的列
temp(ic) = size(find(Data(ir,:) == Data(ir,ic)),2);
以ir=1,ic=2为例说明
>> Data(1,:)%第一行所有的数
ans =
1 2 3 2 2
>> Data(1,2)%第一行第二列的数
ans =
2
>> find(Data(1,:) == Data(1,2))%找出 “Data(1,:)中大小为Data(1,2)的数” 所在的列的序号
ans =
2 4 5
>> size(find(Data(1,:) == Data(1,2)),2)%计算 “Data(1,:)中大小为Data(1,2)的数” 的数目
ans =
3
2、第二句:
C = max(A,[],dim) returns
the largest elements along the dimension of A specified
by scalar dim.For example,max(A,[],1) produces
the maximum values along the first dimension (the rows) 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.
[data id] = max(temp,[],2);%求出temp每行最大的数data ,并返回该数的序号id
3、第三句
out(ir) = Data(ir,id); %ir为行数,id为出现最多次数的数所在的列
再问: 好的,理解的一半,亲再给我解释下[data id] = max(temp,[],2);这一句和out(ir) = Data(ir,id); 这一句好吗 谢谢了
再答: 已解答 2、第二句: C = max(A,[],dim) returns the largest elements along the dimension of A specified by scalar dim. For example, max(A,[],1) produces the maximum values along the first dimension (the rows) 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. [data id] = max(temp,[],2);%求出temp每行最大的数data ,并返回该数的序号id 3、第三句 out(ir) = Data(ir,id); %ir为行数,id为出现最多次数的数所在的列
Matlab程序中temp(ic)= [data id]= out(ir) = Data(ir,id);这三句看不懂 程
sql="select * from "&data&" where id="&myid&"" 在数据库中没有data 这
matlab 中 c=data.
MFC中data=data
matlab中K=((data*data')+1).^d;和K=((data*data')+1)^d;有何区别
matlab中data(:,3)=data(:,3).*lx一句中的:代表啥意思?
【物理】闭合电路中U=E-Ir能不能变形成IR=E-Ir
matlab mx=data(:,1:5);
MATLAB A=data(:,[4:21])
where id='"&session("id")&
matlab问题解决data=rand(1000,2);x=data(:,1);y=data(:,2);II=find(
欧姆定律闭合电路欧姆定律(闭合电路)中E=IR+Ir; 当外电路断开时即R=无穷大,I=0,但IR不等于0...Ir=0