Collect matrix values by using a "for" loop

조회 수: 2 (최근 30일)
Tobias Riewendt
Tobias Riewendt 2020년 1월 14일
댓글: Tobias Riewendt 2020년 1월 14일
Hello, I am new at Matlab and have a question about using a for loop.
I have a matrix with 311 rows and 111 columns. I want to collect the values and want to create a new one with all values in one column.
This means that the algorithm should collect all values of the first row of the matrix (column 1 till 111) and put them into a new matrix with 1 column (row 1 till 111).
Next, the values of the columns 1 till 111 of the second row are collected and also entered into the first column of the new matrix (row 112 till 223).
This schould be done until the last row (311). In the end there should be some kind of a list.
Can anyone help me?
Yours,
Tobias

채택된 답변

Andrei Bobrov
Andrei Bobrov 2020년 1월 14일
Let A - your array.
out = reshape(A.',[],1);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by