clc;
clear;
a=[1 2 3 4;
5 6 7 8;
9 10 11 12];
%取第三列元素
temp=a(:,3);
m=length(temp);
for i=1:m
%先取元素
t=temp(i);
t2(i)=0;
%t2将保存第三别的位数
while abs(t-0)>=1
t2(i)=t2(i)+1;
t=t/10;
end
end
t2=(10.^(-1*(t2)));
t2=t2';
a=[a(:,1),a(:,2)+(t2.*a(:,3)),a(:,4)]
如果单纯合并两列,这样试试。
a=[a(:,1),a(:,2)+0.1*a(:,3),a(:,4)]
format short g
放在一起不难,但有两个问题:
1、两列数据都是整数吗?
2、这样放在一起你认为含义靠谱吗?比如2.2>2.11?