How can I remove empty arrays of cell

조회 수: 2 (최근 30일)
Farshid Daryabor
Farshid Daryabor 2020년 4월 16일
댓글: Stephen23 2020년 4월 16일
please find attached file, how can I remove empty row of cell arrays. Thanks in advance,
  댓글 수: 2
Stephen23
Stephen23 2020년 4월 16일
편집: Stephen23 2020년 4월 16일
"how can I remove empty row of cell arrays"
None of the cells are empty:
>> any(cellfun(@isempty,time))
ans = 0
All of the cells contain a scalar structure (which is inefficient storage: one non-scalar structure would be much better).
Farshid Daryabor
Farshid Daryabor 2020년 4월 16일
I don't understand, what do you mean?
I want just remove '[]' arrays from 'time'

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 16일
Run this
idx = cellfun(@(x) isempty(x), time);
time(idx) = [];
  댓글 수: 2
Farshid Daryabor
Farshid Daryabor 2020년 4월 16일
Thanks, it's what I expected
Stephen23
Stephen23 2020년 4월 16일
No need for an anonymous function:
idx = cellfun(@isempty, time);

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by