Delete all rows from a cell array

조회 수: 2 (최근 30일)
Gauravveer Singh
Gauravveer Singh 2021년 7월 5일
편집: Yongjian Feng 2021년 7월 5일
I have a cell array of 1x24 tables and all have stored variables and contain numeric values . I want to delete all the rows by looking at one variable in whose value is greater than 7 .
Thank you in advance
  댓글 수: 1
Image Analyst
Image Analyst 2021년 7월 5일
Can you attach your cell array containing tables in a .mat file with the paperclip icon?
save('answers.mat', 'yourCellArray');
Which cell or table row or table column contains "one variable in whose value is greater than 7"? Where are we supposed to look for the values above 7? I have no idea.

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

답변 (1개)

Yongjian Feng
Yongjian Feng 2021년 7월 5일
arr = cell2mat(cellArray); % convert to array first
arr(arr>7) = []; % remove
cellArray = num2cell(arr); % convert back
  댓글 수: 2
Gauravveer Singh
Gauravveer Singh 2021년 7월 5일
thanks a lot
Yongjian Feng
Yongjian Feng 2021년 7월 5일
편집: Yongjian Feng 2021년 7월 5일
If it works, accept the answer please.

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

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by