Hello,
Suppose output(:,:) is matrix with 5 rows and 10 columns.
u is from 1 to n. So, i will have n different output(:,:) matrix's which i am saving in outp(:,:,u).
for u= 1:n
outp(:,:,u) = output(:,:);
end
then how can i pre allocate outp(:,:,u) with zeros so that i can increase speed.
will it be outp(:,:,u)= zeros(5*n,10)?
Thank You

 채택된 답변

Yu Jiang
Yu Jiang 2014년 9월 6일
편집: Yu Jiang 2014년 9월 6일

0 개 추천

outp(:,:,u)= zeros(5, 10, n)

댓글 수: 2

Or even simpler:
outp = zeros(5, 10, n);
What you wrote works (if outp didn't exist), it's very confusing.
Yu Jiang
Yu Jiang 2014년 9월 6일
Guillaume
Your version is much better :)
-Yu

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 9월 6일

댓글:

2014년 9월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by