How to find the index of missing values in a cell array without looping through each element?
    조회 수: 20 (최근 30일)
  
       이전 댓글 표시
    
S1 = struct();
S2 = struct();
C = {S1 S2 missing};
댓글 수: 0
채택된 답변
  Voss
      
      
 2022년 7월 11일
        You can use cellfun to call ismissing on the contents of each cell:
S1 = struct();
S2 = struct();
C = {S1 S2 missing}
is_missing = cellfun(@ismissing,C)
idx_missing = find(is_missing)
(That's not got much loops.)
댓글 수: 0
추가 답변 (1개)
  Bharat Chandra Mukkavalli
      
 2022년 7월 11일
        Hi,
You can use the "cellfun()" function to apply a function to all the contents in a cell array. Further documentation on cellfun() can be found here: https://in.mathworks.com/help/matlab/ref/cellfun.html
Refer to link here on finding the indices of non-empty cells in a cell array: https://in.mathworks.com/matlabcentral/answers/42283-index-non-empty-cells-in-cell-array
Hope this helps!
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


