fusing matrix values within two cell arrays

The code below gives me two cell arrays mx and mn. I want the matrix values in the cell array mx to be fused with the matrix values in mn. The values of mx should be adjacent to the values in mn in every matrix table. How can I do that?
a={rand(1877958,7); rand(1251972,7)};
b=cellfun(@(x) [x; repmat(x(end,:),-mod(size(x,1),-60),1)],a,'un',0);
n = 61;
for k = 1:n
for i=1:length(b)
c = circshift(b{i}, [-(k-1) 0]);
mn(i,k)={max(reshape(c(:,4),60,[])).'};
mx(i,k)={min(reshape(c(:,5),60,[])).'};
end
end

 採用された回答

Star Strider
Star Strider 2015 年 10 月 5 日

1 投票

See if this does what you want:
mcat = cat(1, mn, mx);

7 件のコメント

AA
AA 2015 年 10 月 5 日
編集済み: AA 2015 年 10 月 5 日
no it doesnt work. I want the values to be adjacent to the values in the matrices side by side.
mcat = cat(1, mn{1,1}, mx{1,1}); this works but i want all the values in the cell array to be covered and i want the values adjacent in columb 2
Star Strider
Star Strider 2015 年 10 月 5 日
My second guess then is:
mcat = cat(2, mn, mx);
AA
AA 2015 年 10 月 5 日
it just places the matrices in the cell array next to each other. you get a cell array with a 2X122 dimension. I, however, want the changes to take place within the matrix of the cell array.
Star Strider
Star Strider 2015 年 10 月 5 日
I’m lost. Define ‘fused’, preferably with a short example.
AA
AA 2015 年 10 月 5 日
this is what i mean by fusing
mcat = cat(2, mn{1,1}, mx{1,1});
but I want this formula to be applied to all the matrices in the cell array.
Star Strider
Star Strider 2015 年 10 月 5 日
I’m still not certain what you want to do. I would just do that as a third statement in your ‘i’ loop:
mcat{i,k} = cat(2, mn(i,k), mx(i,k));
AA
AA 2015 年 10 月 5 日
編集済み: AA 2015 年 10 月 5 日
for x = 1:2
for y = 1:61
mcat = cat(2, mn{x,y}, mx{x,y});
mcat1{x,y} = mcat;
end
end

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

質問済み:

AA
2015 年 10 月 5 日

編集済み:

AA
2015 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by