Remove specific cells in a cell array

조회 수: 29 (최근 30일)
Khoder Makkawi
Khoder Makkawi 2023년 2월 15일
댓글: Voss 2023년 2월 16일
I have a field_list that contains a large number of cells I will show a simple example :
fields_list = {'mode','time','date','Nav','state',...};
and I have another list for the fields I want to remove, for the same example:
remove_list = {'mode','date','Nav',,...};
is there a way to remove the 'remove_list' from the field_list' ?
Taking into account that the the fields_list and the remove_list are much bigger than this.

채택된 답변

Voss
Voss 2023년 2월 15일
fields_list = {'mode','time','date','Nav','state'};
remove_list = {'mode','date','Nav'};
fields_list(ismember(fields_list,remove_list)) = []
fields_list = 1×2 cell array
{'time'} {'state'}
  댓글 수: 2
Khoder Makkawi
Khoder Makkawi 2023년 2월 16일
Thank you
Voss
Voss 2023년 2월 16일
You're welcome!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by