Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MATLAB中将一组N行移动到另一列_Matlab_Copy_Rows - Fatal编程技术网

在MATLAB中将一组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

是否可以不将一组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 = 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) = [];

如果我的回答没有针对您的情况,您能否详细说明“移动”(期望的行为、对矩阵大小的影响、其他列)的含义?如果我的回答没有针对您的情况,您能否详细说明“移动”(期望的行为、对矩阵大小的影响、其他列)的含义?