필터 지우기
필터 지우기

Concatenate two cells into another

조회 수: 2 (최근 30일)
António
António 2014년 12월 30일
편집: Yona 2015년 1월 1일
I have a cell with 'Aluno' and other cell with '41563'and i need to have another one with 'A41563'. How can i concatenate the first two cells to get the last one?

채택된 답변

Yona
Yona 2014년 12월 30일
do you try to use strcat?
It allow you to concatenate two cells.
Ce = {'Aluno', '41563'};
C3 = strcat(Ce{1}(1),Ce{2});
  댓글 수: 2
António
António 2014년 12월 30일
It is parcially wright. The last cell gets the 'A' from 'Aluno' but did't shows the number from the other cell. Can it be caused because i'm using it to write in a table?
Yona
Yona 2015년 1월 1일
편집: Yona 2015년 1월 1일
no, it probably because the number you have is a number not a string.
try:
C3 = strcat(Ce{1}(1),num2str(Ce{2}));
or:
C3 = [Ce{1} num2str(Ce{2})];

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

추가 답변 (1개)

Ilham Hardy
Ilham Hardy 2014년 12월 30일
Another way is,
Ce = {'Aluno', '41563'};
C3 = [Ce{1} Ce{2}];
Mind the curly brackets {} !

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by