MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   在MATLAB中,该表达式是否具有非迭代等效项? (https://www.labfans.com/bbs/showthread.php?t=26506)

poster 2019-12-14 20:13

在MATLAB中,该表达式是否具有非迭代等效项?
 
表达式是:

for i=1:n X(:,i) = [P{i}(:)]; end 其中X是DxN矩阵,P是单元数组。



[B]回答:[/B]

如果通过mat2cell获得了单元阵列,则可能需要将图像的块排列到阵列X的列中。可以使用命令[URL="http://www.mathworks.com/help/toolbox/images/ref/im2col.html"]IM2COL[/URL]在一个步骤中完成此[URL="http://www.mathworks.com/help/toolbox/images/ref/im2col.html"]操作[/URL]

%# rearrange the large array so that each column of X %# corresponds to the 4 pixels of each 2-by-2 block X = im2col(largeArray,[2 2],'distinct');

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


所有时间均为北京时间。现在的时间是 03:04

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