identify rows with [] within a cell

2 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 2 Déc 2023
Déplacé(e) : Dyuman Joshi le 2 Déc 2023
Hi! Is there any way to identify rows with [] within a cell? Something that is analogous to 'find'.
[rr,cc] = find(M(:,1) == []);

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 2 Déc 2023
Déplacé(e) : Dyuman Joshi le 2 Déc 2023
You should use isempty for checking if an array (of any data type) is empty or not -
load('M.mat')
M
M = 6×1 cell array
{ 0×2 double} {36×2 double} {22×2 double} { 3×2 double} { 0×2 double} { 2×2 double}
cellfun('isempty', M)
ans = 6×1 logical array
1 0 0 0 1 0

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by