在MATLAB中将一组N行移动到另一列
是否可以不将一组N行从一列复制到另一列,而将其移动 这是我将行“复制”到另一列的代码在MATLAB中将一组N行移动到另一列,matlab,copy,rows,Matlab,Copy,Rows,是否可以不将一组N行从一列复制到另一列,而将其移动 这是我将行“复制”到另一列的代码 numberofPdbs(1:235,2) = numberofPdbs(236:end,1); 我需要找到一种方法把他们转移到另一列 numberofPdbs(1:235,2) = numberofPdbs(236:end,1); 请告知。移动列: %# Columns before destination are shifted back. %# Matrix size unchanged. data
numberofPdbs(1:235,2) = numberofPdbs(236:end,1);
我需要找到一种方法把他们转移到另一列
numberofPdbs(1:235,2) = numberofPdbs(236:end,1);
请告知。移动列:
%# Columns before destination are shifted back.
%# Matrix size unchanged.
data = rand(100);
desiredCol = 5;
destinationCol = 15;
data = [ data(:,1:desiredCol-1) ...
data(:,desiredCol+1:destinationCol) ...
data(:,desiredCol) ...
data(:,destinationCol+1:end) ];
交换两列:
%# Matrix size unchanged.
temp = data(:,destinationCol);
data(:,destinationCol) = data(:,desiredCol);
data(:,desiredCol) = temp;
使用覆盖移动:
%# Destination is not preserved.
%# Matrix size decreases by 1.
data(:,destinationCol) = data(:,desiredCol);
data(:,desiredCol) = [];
移动列:
%# Columns before destination are shifted back.
%# Matrix size unchanged.
data = rand(100);
desiredCol = 5;
destinationCol = 15;
data = [ data(:,1:desiredCol-1) ...
data(:,desiredCol+1:destinationCol) ...
data(:,desiredCol) ...
data(:,destinationCol+1:end) ];
交换两列:
%# Matrix size unchanged.
temp = data(:,destinationCol);
data(:,destinationCol) = data(:,desiredCol);
data(:,desiredCol) = temp;
使用覆盖移动:
%# Destination is not preserved.
%# Matrix size decreases by 1.
data(:,destinationCol) = data(:,desiredCol);
data(:,desiredCol) = [];
如果我的回答没有针对您的情况,您能否详细说明“移动”(期望的行为、对矩阵大小的影响、其他列)的含义?如果我的回答没有针对您的情况,您能否详细说明“移动”(期望的行为、对矩阵大小的影响、其他列)的含义?