fill row of matrix

49 Ansichten (letzte 30 Tage)
yousef Yousef
yousef Yousef am 9 Apr. 2014
Kommentiert: Ayesha Punjabi am 16 Apr. 2019
Assume I have d=[1 3 5 6 7 8 1 4 5 10], and e=zeros(5,10). I want to take only the first 4 elements of d and put them into the first row of e.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 9 Apr. 2014
d=[1 3 5 6 7 8 1 4 5 10],
e=zeros(5,10)
e(1,1:4)=d(1:4)
  3 Kommentare
yousef Yousef
yousef Yousef am 10 Apr. 2014
Is it possible to remove repetitions from the adjacent rows(I'm not talking about zeros) ?
8 1 6 7 5 10 9 3 4 2
3 1 6 8 0 0 0 0 0 0
3 4 5 9 0 0 0 0 0 0
2 8 5 1 0 0 0 0 0 0
2 4 3 10 0 0 0 0 0 0
Ayesha Punjabi
Ayesha Punjabi am 16 Apr. 2019
+1
even i have the same doubt...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by