MATLAB Answers

convert matrix to vector in a loop

21 views (last 30 days)
Elahe Karimi
Elahe Karimi on 5 Jun 2019
Commented: Elahe Karimi on 5 Jun 2019
Hello
I have a matrix with (144x10). I want to put 4 rows in the first row together as a vector and move it to a new matrix.(rows,40) Then put 4 next rows together as vectors and put them in a new matrix until the end in the same way.
a matrix:
(row1,40)
(row1,40)
(row1,40)
(row1,40)
(row1,40)
(row1,40)
.....
.....
please help me
thank you

  0 Comments

Sign in to comment.

Accepted Answer

Dennis
Dennis on 5 Jun 2019
Edited: Dennis on 5 Jun 2019
Please check if this works for you:
A=randi(100,144,10); %matrix of size (144,10)
B=reshape(A',40,36);
B=B';

  1 Comment

Elahe Karimi
Elahe Karimi on 5 Jun 2019
thank you so much.it works.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags


Translated by