필터 지우기
필터 지우기

how can i change the dimensions of a matrix?

조회 수: 2 (최근 30일)
naadiya khudabux
naadiya khudabux 2016년 10월 2일
답변: Walter Roberson 2016년 10월 2일
how can i change the dimensions of a matrix from 100000*5 to column vector 100000*1 without making any change of sequence of records

답변 (2개)

KSSV
KSSV 2016년 10월 2일
k = rand(100000,5); %random matrix
k1 = k(:,1) ;% first column
k2 = k(:,2) ;% second column
ki = k(:,i) ;% ith column, i=1,2,3,5
Read about matrix indexing.
  댓글 수: 2
naadiya khudabux
naadiya khudabux 2016년 10월 2일
it would b 5 variable. i want to change matrix to a vector with same length .

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


Walter Roberson
Walter Roberson 2016년 10월 2일
k = k(:,1);
This would lose information.
Is your intention that each element of the 100000 x 1 would be a vector of length 5? If so then
k_cell = mat2cell(k, ones(1, size(k,1)), size(k, 2));

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by