Convert 3 dimensional matrix to vector (rows to columns)
조회 수: 22 (최근 30일)
이전 댓글 표시
Hi I have a 3 dimensional matrix that I am trying to convert the rows to columns and then stack all the columns to generate a vector that will have the three dimensions. I am struggling with the coding of this
So far I have
PV_power_output(:,:,K) = real((Vmpp_(:,:,K).*Impp_(:,:,K))*inverter_efficiency)/1000; % Power output in kW
PV_energy(:,:,K) = sum(sum(PV_power_output(:,:,K))) ; % Energy output in kWh
PV_rows_to_columns(:,:,K) = PV_power_output(:,:,K)';
PV_power_output is a 365x24x3 matrix and I am trying to convert it to a 8760x1x3 vector
Thanks
댓글 수: 0
채택된 답변
Thomas
2012년 6월 20일
doc reshape
out = reshape(PV_power_output,8760,1,3);
Warning: read the reshape help document thoroughly as it does columnwise reshape..
댓글 수: 12
Walter Roberson
2012년 6월 20일
Sorry should be
permdims([1 2]) = permdims([2 1]);
These are indices into permdims, which in turn is 1 to the dimension number, so the result is to get
[2 1 3 4 5 6 .... dimension number]
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!