Filter löschen
Filter löschen

Find number of rows of each array in a cell

1 Ansicht (letzte 30 Tage)
Asim Ismail
Asim Ismail am 18 Mai 2017
Bearbeitet: Guillaume am 18 Mai 2017
I have a cell of size 4x4, and each array in this cell is a matrix having size nx2. How can I find n(number of rows) of each matrix, any idea?

Akzeptierte Antwort

Guillaume
Guillaume am 18 Mai 2017
cellfun(@(c) size(c, 1), yourcellarray)
  3 Kommentare
Stephen23
Stephen23 am 18 Mai 2017
Faster:
cellfun('size', yourcellarray, 1)
Guillaume
Guillaume am 18 Mai 2017
Bearbeitet: Guillaume am 18 Mai 2017
Faster but deprecated for several years now. Also will not work correctly if the cell array contains objects of a class that overloads the size method (admittedly something very rare).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by