简体   繁体   中英

MATLAB: Converting 3D matrix to cell array

My goal is to convert 192x88x3 matrix to 3x1 cell array which includes 192x88 arrays. I used mat2cell in MATLAB but the result is 1x1x3 cell array which looks weird.

a=rand(192,88,3);
b=mat2cell(a, [192],[88],[1 1 1])
whos b
b         1x1x3            405840  cell   

What should I do?

您可以使用squeeze来删除多余的单例尺寸。

b = squeeze(mat2cell(a, [192],[88],[1 1 1]));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM