필터 지우기
필터 지우기

Combining Cells into a single cell

조회 수: 442 (최근 30일)
Hello kity
Hello kity 2013년 1월 9일
댓글: Pooja Patel 2017년 2월 24일
How can I combine multiple cells in to a single cell
there are 6 cells, each m x n format (n is 17 in all)
I want a new cell created that just adds up below
so for example Cell1 is 50x17 Cell2 is 30x17 Cell3 is 20x17
new cell should then be : AllCell is 100x17
I thought of:
Allcell=cell(Cell1+Cell2+Cell3,17);
but what then
  댓글 수: 4
Hello kity
Hello kity 2013년 1월 9일
편집: Hello kity 2013년 1월 9일
I found a way but i think it should be easier.
raw is from xlsread, a cell.
A=length(raw1);
B=length(raw2);
C=length(raw3);
D=length(raw4);
E=length(raw5);
F=length(raw6);
lengthcell=A+B+C+D+E+F;
All=cell(lengthcell+5,17);
All(1:A, 1:17)=raw1;
All(A+2:A+B+1, 1:17)=raw2;
All(A+B+3:A+B+2+C, 1:17)=raw3;
All(A+B+C+4:A+B+C+D+3, 1:17)=raw4;
All(A+B+C+D+5:A+B+C+D+E+4, 1:17)=raw5;
All(A+B+C+D+E+6:A+B+C+D+E+F+5, 1:17)=raw6;
between every set of data there is a cell row free.
Jongyoung Song
Jongyoung Song 2017년 1월 24일
AllCell = [Cell1; Cell2; Cell3];

댓글을 달려면 로그인하십시오.

채택된 답변

Thorsten
Thorsten 2013년 1월 9일
편집: Thorsten 2013년 1월 9일
use the standard concatenation operator [ ]
AllCell = [Cell1; Cell2; Cell3; Cell4; Cell5; Cell6];
  댓글 수: 2
Hello kity
Hello kity 2013년 1월 9일
hmm, i tried this but with , instead of ; inbetween the Cells.
Thank you
kiarash Dousti
kiarash Dousti 2016년 7월 19일
Thanks a lot dear Thorsten. It reclaim me

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2013년 1월 9일
If your cells are not called "Cell1", "Cell2", ... but you use an index as index (as suggested repeatedly and consequently in this forum), the concatenation is even easier:
C{1} = rand(50, 17);
C{2} = rand(10, 17);
C{3} = rand(40, 17);
C{4} = rand(30, 17);
C{5} = rand(20, 17);
AllC = {cat(1, C{:})};
  댓글 수: 5
giri wira
giri wira 2015년 6월 11일
thanks simon, very usefull
Pooja Patel
Pooja Patel 2017년 2월 24일
thank you so much mr.simon. this is working very well.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by