필터 지우기
필터 지우기

how can I store chars of a cells with different length in a matrix

조회 수: 4 (최근 30일)
fadi awar
fadi awar 2021년 4월 23일
댓글: fadi awar 2021년 4월 23일
hello,
in a for loop located in a function i was able to get the cell arrays in the following form:
1st: {'R1'} {'R3'} {'R4'}
2nd: {'R1'} {'R3'} {'R6'} {'R5'} {'R4'}
how can i store these outputs in a matrix as:
{'R1'} {'R3'} {'R4'} 0 0
{'R1'} {'R3'} {'R6'} {'R5'} {'R4'}
as the output of my function (or after ending the for loop)

채택된 답변

Stephen23
Stephen23 2021년 4월 23일
C = cell(N,0);
for k = 1:N
tmp = ... the output of your function (cell vector)
C(k,1:numel(tmp)) = tmp;
end
  댓글 수: 3
Stephen23
Stephen23 2021년 4월 23일
Following what I wrote in my answer:
ruse = cell(np,0);
for k = 1:np
pk = allp{k};
nodrout = routers(pk);
ruse(k,1:numel(nodrout)) = nodrout;
end
fadi awar
fadi awar 2021년 4월 23일
thank you it worked perfectly
i really appreciate your help

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

추가 답변 (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