필터 지우기
필터 지우기

fusing matrix values within two cell arrays

조회 수: 2 (최근 30일)
AA
AA 2015년 10월 5일
편집: AA 2015년 10월 5일
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일
See if this does what you want:
mcat = cat(1, mn, mx);
  댓글 수: 7
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개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by