convert a matrix to column vector

5 ビュー (過去 30 日間)
Budoor Salem
Budoor Salem 2021 年 2 月 21 日
コメント済み: Budoor Salem 2021 年 2 月 21 日
I woule like to convert a matrix [31,6000] to a cloumn vector
31 rows and 6000 column
to one column vector
please advice
  2 件のコメント
Budoor Salem
Budoor Salem 2021 年 2 月 21 日
編集済み: Budoor Salem 2021 年 2 月 21 日
I have 2 vectors and one matrix that I would like to fit them all on one matrix with 31 columns
the 1st vector is 6000 elements t=[0:0.1:600]
the 2nd vector is 31 emments : x=[0:0.01:0.3]
the matrix c is numbers with size of 31 rows and 6000 columns
so what I need to do is to make a new matrix where the it has 6000 rows and 3 columns
where the fisrt coumn is t
t=
0
0.1
0.2
0.3
.
.
6000
then the second colum of the matrix is the x vector strating from
0
0.01
0.02
.
.
31
and repeated
meaning each value of t whould have 31 diffrent value of x
finall the matrix c I would like to convert it to a column vector to be as a third coumn in the new matrix
please help
Walter Roberson
Walter Roberson 2021 年 2 月 21 日
temp = repmat(x(:), 200,1);
x6 = temp(1:6000);

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 21 日
TheMatrix(:)
%or
reshape(TheMatrix,[],1)
The order would be all of column 1, followed by all of column 2, then all of column 3, and so on.
If you need it to be ordered all of row 1 followed by all of row 2, and so on, then
reshape(TheMatrix.',[],1)
  1 件のコメント
Budoor Salem
Budoor Salem 2021 年 2 月 21 日
thank you so much

サインインしてコメントする。

その他の回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 21 日
result=matrix(:)
  1 件のコメント
Budoor Salem
Budoor Salem 2021 年 2 月 21 日
thank you so much

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by