필터 지우기
필터 지우기

Storing a vector as a row of a matrix?

조회 수: 2 (최근 30일)
Bhavz
Bhavz 2014년 11월 6일
댓글: Guillaume 2014년 11월 6일
How would one store different vectors as different rows of a matrix?
eg in this case
for ii=1:16
A(ii)=0;
C(ii)=0;
for jj=1:4
for kk=1:8
A(ii)=A(ii)+hd(jj)*delta_edp(ii,jj,kk);
Ae(ii,:)=A(ii);
X(ii,:)= X_dp(jj,kk);
X(ii,:)=ro_max;
Aeq(ii,:)=Ae(ii)*X(ii);
end
end

채택된 답변

Rick Rosson
Rick Rosson 2014년 11월 6일
N = 12;
x = rand(1,N);
y = rand(1,N);
z = rand(1,N);
A = [ x ; y ; z ] ;
  댓글 수: 2
Bhavz
Bhavz 2014년 11월 6일
편집: Bhavz 2014년 11월 6일
Even when the vector is being created using a for loop ?
eg
for ii=1:16
A(ii)=0;
C(ii)=0;
for jj=1:4
for kk=1:8
A(ii)=A(ii)+hd(jj)*delta_edp(ii,jj,kk);
Ae(ii,:)=A(ii);
X(ii,:)= X_dp(jj,kk);
X(ii,:)=ro_max;
Aeq(ii,:)=Ae(ii)*X(ii);
end
end
Guillaume
Guillaume 2014년 11월 6일
Now that you've accepted an answer nobody is going to look at your completely different question. You would be better off starting a new question. (and you shouldn't have edited the original question, as the accepted answer no longer matches it).
When you do start a new question, please specify which vectors in your example you want to store as rows.

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

추가 답변 (0개)

카테고리

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