how to remove [0,0,0] cell from an array
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The Sanchi
am 16 Okt. 2021
Kommentiert: The Sanchi
am 18 Okt. 2021
I have a 8X1 column cell array with zeros as follows
[0,0,0]
4x3 double
5x3 double
10x3 double
6x3 doubel
[0,0,0]
4x3 double
8x3 double
Each cell has Nx3 data inside. [0,0,0] is 1x3 . I want to remove the cells that includes [0,0,0] and obtain
4x3 double
5x3 double
10x3 double
6x3 double
4x3 double
8x3 double
when I use
for i = 1:8
A{i}(A{i} == 0) = [],
end
it gives an error, "Brace indexing not supported for variables this type"
Thank you in advance !!!!
0 Kommentare
Akzeptierte Antwort
DGM
am 17 Okt. 2021
Consider:
C = {rand(2,3) rand(3,3) rand(4,3) [0 0 0] rand(5,3)}.'
iszerotuple = cell2mat(cellfun(@(x) isequal(x,[0 0 0]),C,'uniform',false))
C = C(~iszerotuple)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!