필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

matrix shape is incorrect??

조회 수: 1 (최근 30일)
Kevin
Kevin 2014년 7월 24일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I have the following code which will give me values of F along a plane surface. It should give me a vecor matrix in a 1x9 shape. However the resulting matrix appears to be a 9x1 shape.
for Q=1:length(Phi)
if Phi(Q)<0;
F(Q)=1;
else
F(Q)=(2/pi) .* acos(exp(-(((B/2) .* (1-(r_over_R(Q)))) ./ ((r_over_R(Q)) .* sin(relative_wind(Q)))))); % Tip Loss Factor
end;
end;
Does anybody know how I can change this? Thanks.

답변 (2개)

Wayne King
Wayne King 2014년 7월 24일
편집: Wayne King 2014년 7월 24일
You don't give us all the variables here so we can't tell you how to change in the loop, but the simple thing to do is at the end of the loop (after the final "end"), just do
F = F';
The above assumes that F is real-valued. If F is complex-valued and you don't want to conjugate the elements, do
F = F.';
  댓글 수: 1
Michael Haderlein
Michael Haderlein 2014년 7월 24일
That's one option, or you just preallocate F by
F=zeros(size(Phi));
Then you'll get the same shape, improved memory efficiency and no more a warning at the respective line.
Best regards,
Michael

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 24일
It's simple, just transpose the result
A=A'

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by