필터 지우기
필터 지우기

Info

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

Changing matrix size in a loop

조회 수: 1 (최근 30일)
Burak
Burak 2017년 3월 26일
댓글: Burak 2017년 3월 27일
Hi , I need to calculate a 3D matrix , say A(v,n,i) , here is code
for n=1:5
for m=-n:n
for v=1:5
A(v,n,i)=% My Fucntion
A( ~any(A,2), :,: ) = [];
A( :, ~any(A,1),: ) = [];
end
end
end
I need to calculate A as a changing size according to m values, like if m=1 , A=10x10 , if m=2 , A=9x9 and same as for negative values of m. If I calculate A like my code , I can't get inverse of A for m>1 or m<-1. Also I tried to delete zeros columns and rows of A(:,:,i) but I couldn't do it because of 3D matrix. Thanks for any help.
  댓글 수: 3
Geoff Hayes
Geoff Hayes 2017년 3월 27일
Please don't post the same question twice: https://www.mathworks.com/matlabcentral/answers/332046-matrix-size-changing-in-a-loop. If you have not received a response to your question, the modify it so that it appears as a recent update (and so is at the "top" of the queue).
Burak
Burak 2017년 3월 27일
I did search my previous question in matlab and in my account tab , I couldn't find so I posted it again. Sorry. For my question , lets say
for n=1:5
m=-n:n;
for v=1:5
A(v,n,i)=v*n-m(i);
end
end
end
for i=1:11
Ai(:,:,i)=inv(A(:,:,i));
end
Like this I can't inverse it. I found a solution , I placed all A variables in a cell array then I removed zeros from it and I can inverse it in a cell array but it is really challenging , I am asking if there is another way to calculate A's in changing size in every loop. Thanks for the concern.
end

답변 (0개)

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

Community Treasure Hunt

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

Start Hunting!

Translated by