フィルターのクリア

hi i have 1x36 cell,each cell contains 2x2 cell, how to convert it into 4x36 double in matlab

1 回表示 (過去 30 日間)
plz help me

採用された回答

Guillaume
Guillaume 2016 年 11 月 22 日
cell2mat(cellfun(@(c) reshape(cell2mat(c),[], 1), yourcellarray, 'UniformOutput', false))
Although if it's a continuation of the previous question, then change the code to:
cell2mat(cellfun(@(m) reshape(cellfun(@(quadrant) max(quadrant(:)), ... max of a quadrant
mat2cell(m, ... convert matrix in cell into cell of 4 quadrant
[ceil(size(m, 1)/2), floor(size(m, 1)/2)], ...
[ceil(size(m, 2)/2), floor(size(m, 2)/2)])), ...
[], 1), ... reshape maxs of quadrant into column vector
yourcellarray, 'UniformOutput', false)) %process each cell

その他の回答 (1 件)

KSSV
KSSV 2016 年 11 月 22 日
clc; clear all ;
A = cell(1,36) ;
for i = 1:36
A{i} = cell(2) ;
A{i}{1,1} = rand(2) ;
A{i}{1,2} = rand(2) ;
A{i}{2,1} = rand(2) ;
A{i}{2,2} = rand(2) ;
end
%
B = cell(1,36) ;
for i = 1:36
B{i} = cell2mat(A{1}) ;
end
or
iwant = cellfun(@cell2mat,A,'un',0);
  1 件のコメント
kaavya subramani
kaavya subramani 2016 年 11 月 22 日
Sir i got 1x36 cell as answer,as per your code, but i need 4x36 double as answer

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by