MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab:如何更改矩阵的存储方式?从1x1x3到1x3? (https://www.labfans.com/bbs/showthread.php?t=26184)

poster 2019-12-14 20:13

Matlab:如何更改矩阵的存储方式?从1x1x3到1x3?
 
我目前有:

val(:,:,1) = 0.7216 val(:,:,2) = 0.7216 val(:,:,3) = 0.7216 但我想要

0.7216, 0.716, 0.721. 我可以执行哪种操作?



[B]回答:[/B]

reshape功能将在这里完成操作:

% Arrange the elements of val into a 1x3 array val = reshape(val, [1 3]); 因为要转换为行向量,所以以下语法也将起作用:

val = val(:)'; 因为val(:)创建一个列向量,然后转置运算符'然后将该列向量转置为行向量。



[url=https://stackoverflow.com/questions/4723563]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:30

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.