create a cell array of N dimensions of type char

조회 수: 2 (최근 30일)
Robert Scott
Robert Scott 2021년 7월 29일
댓글: Robert Scott 2021년 7월 29일
As the title says,
How do i create a cell array of N dimensions of type char.
Thanks

답변 (1개)

Dave B
Dave B 2021년 7월 29일
편집: Dave B 2021년 7월 29일
A cell array has type cell, but you can use repelem/repmat to make a cell array where each cell contains an empty char:
If you want a cell array of size 1,n where each cell contains an empty char...
repelem({''},n)
Or for a cell of size m,n where each cell contains an empty char:
repmat({''},m,n)
For an n dimensional cell array, where the last dimension has a size>1, something like this:
sz=[1 2 3 4 5];
repmat({''},sz)
  댓글 수: 1
Robert Scott
Robert Scott 2021년 7월 29일
Thanks, i figured it out with repmat after the fact

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

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by