Filter löschen
Filter löschen

How do I assign rows of a matrix to an array?

40 Ansichten (letzte 30 Tage)
Phil Whitfield
Phil Whitfield am 8 Okt. 2017
Bearbeitet: jean claude am 8 Okt. 2017
So I have a Matrix, say A =[1,2,3;4,5,6;7,8,9]
I need to create an array of [4,5,6;7,8,9]
I have been trying a thousand variations of B= num2cell(A(2,:)) and B= num2cell(A(3,:))
but all I can create is obviously just an array of either 4,5,6 or 7,8,9 not them combined.
Any advice?

Akzeptierte Antwort

Image Analyst
Image Analyst am 8 Okt. 2017
Don't mess with cells - too complicated. Just index the rows:
b = A(2:3, :) % Extract rows 2 to 3 only.

Weitere Antworten (1)

jean claude
jean claude am 8 Okt. 2017
Bearbeitet: jean claude am 8 Okt. 2017
B= num2cell(A(2:3,:))
  1 Kommentar
jean claude
jean claude am 8 Okt. 2017
Bearbeitet: jean claude am 8 Okt. 2017
2:3 means from 2nd row until 3rd row of that matrix

Melden Sie sich an, um zu kommentieren.

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