data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
How I can remove the 1st and 5th columns from data aray?

댓글 수: 1

the cyclist
the cyclist 2021년 8월 27일
data is a 10x2 character array, so it does not have a 5th column. I assume you meant row. See my solution.

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

 채택된 답변

the cyclist
the cyclist 2021년 8월 27일
data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
data([1 5],:) = []
data = 8×2 char array
'02' '03' '04' '06' '07' '08' '09' '10'

댓글 수: 2

sermet OGUTCU
sermet OGUTCU 2021년 8월 27일
편집: sermet OGUTCU 2021년 8월 27일
Dear @the cyclist, the column numbers that should be removed are defined as variable such as:
remove=[1 5];
How I can apply the remove variable into the above code rather than writing [1 5] ?
data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
remove = [1 5];
data(remove,:) = []
data = 8×2 char array
'02' '03' '04' '06' '07' '08' '09' '10'
This is a very basic MATLAB question. You might benefit from watching the MATLAB Onramp tutorial.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

질문:

2021년 8월 27일

댓글:

2021년 8월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by