필터 지우기
필터 지우기

How to convert the augmented matrix A into four column vectors respectively

조회 수: 5 (최근 30일)
Eiman Hakimy
Eiman Hakimy 2022년 4월 15일
편집: Pratik Pawar 2022년 5월 16일
Hello i want asking about how i want to convert matrix into 4 column vector ?
here my homework question
  1. convert the augmented matrix A into four column vectors respectively
should i put like this A2 = reshape(A.',4,[]) ?
My example matrix is
  1. for Matrix A
M = [1 2 4; 0 6 1; 1 0 3]
M = 3×3
1 2 4 0 6 1 1 0 3
C=[1 1 1]'
C = 3×1
1 1 1
A = [M C],
A = 3×4
1 2 4 1 0 6 1 1 1 0 3 1
  댓글 수: 2
Matt J
Matt J 2022년 4월 15일
In your example, A already has 4 columns.
Eiman Hakimy
Eiman Hakimy 2022년 4월 15일
편집: Eiman Hakimy 2022년 4월 15일
Hello @Matt J
owh because i got 1 question that i need to convert it.
here my homework question
  1. To convert the augmented matrix A into four column vectors respectively

댓글을 달려면 로그인하십시오.

답변 (1개)

Pratik Pawar
Pratik Pawar 2022년 5월 16일
편집: Pratik Pawar 2022년 5월 16일
If you want to access a particular column, then you can simply assign them to variables as shown in the code below
>> A = [1 2 3 4; 5 6 7 8; 9 10 11 12]
>> C1 = A(:, 1)
>> C2 = A(:, 2)
If you want to access multiple columns or the matrix size is unknown, then you can separate columns using num2cell
>> A = [1 2 3 4; 5 6 7 8; 9 10 11 12]
>> C = num2cell(A, 1)
>> C{1}
>> C{2}
>> C{3}
>> C{4}
OR
[m n] = size(A);
for i = 1:n
C{i}
end

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by