필터 지우기
필터 지우기

how to find and replace corresponding matri

조회 수: 1 (최근 30일)
Triveni
Triveni 2016년 5월 19일
편집: VBBV 2023년 7월 26일
a1{:}
ans =
73.3333 50.0000
66.6667 50.0000
ans =
Empty matrix: 0-by-2
ans =
Empty matrix: 0-by-2
ans =
Empty matrix: 0-by-2
ans =
Empty matrix: 0-by-2
ans =
Empty matrix: 0-by-2
i need to find index for non zero cell array, and convert in into mat.

답변 (3개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 5월 19일
편집: Azzi Abdelmalek 2016년 5월 19일
idx=celfun(@isempty,a1)
a1(idx)=[]
out=cell2mat(a1)

Andrei Bobrov
Andrei Bobrov 2016년 5월 19일
out = cat(1,a1{:})

Guillaume
Guillaume 2016년 5월 19일
편집: VBBV 2023년 7월 26일
idx = find(~cellfun(@isempty, a1)); %index of non empty cell
assert(numel(idx) == 1, 'There are more or less than 1 empty cell')
out = a1{idx}; %get content of cell, which is a matrix in your case

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by