Filter löschen
Filter löschen

Extract rows of a matrix containing the same value in the first column by a loop and build a new matrix

1 Ansicht (letzte 30 Tage)
Hello,
recently I had a problem with extracting rows of a matrix containing the same value in the first column by a loop.
I got a prompt and good answer:
Unfortunately, the above mentioned solution creates a cell as a result and not a matrix.
I already tried to apply A = cell2mat(B) to get the matrix. This command does only work for cells containing arrays with the same length (as far I understood). My arrays in the cell vary in the length of the arrays.
Does anybody know how to have the result as a matrix?
Thank you
Al Falamanki
  1 Kommentar
Guillaume
Guillaume am 26 Feb. 2015
Bearbeitet: Guillaume am 26 Feb. 2015
You can't have a matrix where each element is itself a matrix, or worse a bunch of matrices. Such a thing is a cell array. In a matrix, each element is a scalar.
So, why is a cell array a problem for you? and if it really is, give an example of the matrix you expect.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing 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!

Translated by