reshape,permute函数matlabA = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16];如何得到B:B(:,:,1) = [1,2;5,6];B(:,:,2) = [3,4;7,8];B(:,:,3) = [9,10;13,14];B(:,:,4) = [11,12;15,16];
来源:学生作业学帮网 编辑:学帮网 时间:2024/06/06 14:30:34
reshape,permute函数matlab
A = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16];
如何得到B:
B(:,:,1) = [1,2;5,6];
B(:,:,2) = [3,4;7,8];
B(:,:,3) = [9,10;13,14];
B(:,:,4) = [11,12;15,16];
这个转换可以通过reshape、permute函数实现:
>> B=reshape(permute(reshape(A,[2 2 4]),[1 3 2]),[2 2 4])
B(:,:,1) =
1 2
5 6
B(:,:,2) =
3 4
7 8
B(:,:,3) =
9 10
13 14
B(:,:,4) =
11 12
15 16
不过,个人认为,上述实现方式的表达式比较难懂,不如直接使用cat函数:
>> B=cat(3,A(1:2,1:2),A(1:2,3:4),A(3:4,1:2),A(3:4,3:4))
B(:,:,1) =
1 2
5 6
B(:,:,2) =
3 4
7 8
B(:,:,3) =
9 10
13 14
B(:,:,4) =
11 12
15 16
reshape,permute函数matlabA = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16];如何得到B:B(:,:,1) = [1,2;5,6];B(:,:,2) = [3,4;7,8];B(:,:,3) = [9,10;13,14];B(:,:,4) = [11,12;15,16];
关于MATLAB的reshape函数问题,reshape(A,[],
Mat laboratory 垫实验室
matlab使用函数 reshape 错在哪?>> a=[1 2 3 45 6 7 89 10 11 12]a =1 2 3 45 6 7 89 10 11 12>> b=reshape(a,2,6)Index exceeds matrix dimensions.
尼尔森数据中的MAT是什么意思?
a bamboo mat怎么读
ansys中关于LSEL指令的问题ASEL,U,MAT,,1ASEL,U,MAT,,2ASEL,U,MAT,,3ASEL,U,MAT,,4ASEL,U,MAT,,5
matlab中的reshape命令有什么数学意义?
opencv中 cvFilter2D怎么使用,能不能帮我看看啊,如果一个20*20矩阵对一幅图像做卷积cvFilter2D(img,Grads,&mat,cvPoint(-1,-1));img是输入图像,Grads是输出图像,mat是一个20*20矩阵,这个cvFilter2D函数怎么使用程
#include #include #include #include using namespace std ;typedef vector < vector > Mat ;Mat input() ;void mySort(Mat& a) ;void print(const Mat& a) ;int main(){Mat a = input() ;mySort(a) ;print(a) ;system (PAUSE) ;return 0 ;}Mat input(){ifstream in(
what you think,mat i know
on the mat的中文意思
matlab中 save cities.mat cities -V6;
save changes to library *.mat?该怎么办?
on the mat的中文意思
德国蔡司显微镜Axiovert 40 MAT 价格,
there is a camera on the mat
Nothing Left To Lose Mat Kearney 吉他谱