How to add columns to cell array

조회 수: 18 (최근 30일)
Neville
Neville 2013년 10월 22일
댓글: Neville 2013년 10월 22일
I have this cell array:
cells =
'a' 'b' 'c'
'd' 'e' 'f'
'g' 'h' 'i'
What I want to do is add 2 columns with '-' in them.
cells =
'a' 'b' 'c' '-' '-'
'd' 'e' 'f' '-' '-'
'g' 'h' 'i' '-' '-'
Is it possible to do it dynamically depending on the number of rows?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 22일
[cells repmat({'-'},3,2)]
  댓글 수: 1
Neville
Neville 2013년 10월 22일
Wow it works. Thanks Azzi.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by