I have a matrix and i need to convert it into a vector. Basically i need to remove the dependency of one parameter.Please see the image file i have attached.

 채택된 답변

Star Strider
Star Strider 2018년 1월 7일

1 개 추천

You did not state the result you want. One obvious option is to use the reshape (link) function.

댓글 수: 5

praveen
praveen 2018년 1월 8일
My objective is to decompose or do some factorization so that the matrix will become a vector with same number of rows with only one column.
Image Analyst
Image Analyst 2018년 1월 8일
편집: Image Analyst 2018년 1월 8일
How about this to convert the matrix into a column vector
param2 = data2d(:,1); % Convert column 1 of 2-d data matrix into a column vector.
If not, then state your rule(s) for getting each row of your desired output vector.
Star Strider
Star Strider 2018년 1월 8일
@praveen — The svd (link) function comes quickly to mind.
From the documentation:
  • s = svd(A) returns the singular values of matrix A in descending order.
praveen
praveen 2018년 1월 9일
Hello Star Strider this is exactly the concept i was looking for. I tried this and it gave me a single column vector but with reduced number of rows.If you look at the image i posted in the question the output will have equal number of rows when compared to the input.Please let me know if a modified SVD or any other similar concept is capable of doing this. Thank you very much for the answer.
If the mathematics are not important and any procedure will do, the easiest approach would likely be something like:
Result = mean(A,2,'omitnan')
where ‘A’ is your matrix.

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

추가 답변 (1개)

M Shujah Islam Sameem
M Shujah Islam Sameem 2019년 1월 5일

5 개 추천

%%%% Converting Matix to vector
A = [1 2 3; 4 5 6; 7 8 9] % Example matrix
reshape(A,[],1) % convert matrix to column vector
reshape(A,1,[]) % convert matrix to row vector

카테고리

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

질문:

2018년 1월 7일

답변:

2019년 1월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by