how do i turn an array into a column vector?

I can't work out how to change my array into a column vector. I thought it was just putting ' after it, but that's not working. If I had A=[1,2,3,4] how would I make that into a 4x1 column vector?

댓글 수: 2

Jan
Jan 2012년 5월 24일
For "A = [1,2,3,4]" inserting a ' afterwards is sufficient:
A = [1,2,3,4]'
or:
A = [1,2,3,4]; disp(A');
If this does not work for your code, please post the code and the error message.
Matt Fig
Matt Fig 2012년 11월 2일
I can't work out how to change my array into a column vector. I thought it was just putting ' after it, but that's not working. If I had A=[1,2,3,4] how would I make that into a 4x1 column vector?

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

 채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 23일

10 개 추천

For any kind of array you get a single column vector by
A(:)
Or if you are sure that A is a row vector,
A.'
Caution: A' is the conjugate transpose and the plain transpose is A.'

댓글 수: 2

Tom
Tom 2012년 5월 24일
great thanks walter this is exactly what i needed :)
Andre
Andre 2025년 2월 13일
이동: Stephen23 2025년 2월 13일
Thanks Walter; works perfectly.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

Tom
2012년 5월 23일

이동:

2025년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by