Consider preallocating for speed

Hello,
My lengthy program is littered with 'Consider preallocating for speed' suggestions for numerous variables.
What does a more experienced programmer do to circumvent this? Do I really need to allocate space at the start for every variable which this is suggested for?
Kind regards,
Tom

답변 (1개)

per isakson
per isakson 2014년 2월 13일

0 개 추천

Litter the program with lines like
A = zeros(25000, 10000);

댓글 수: 2

Tom
Tom 2014년 2월 13일
That was pretty much what I thought. However I'm getting:
Subscripted assignment dimension mismatch.
Any idea what I'm doing wrong?
per isakson
per isakson 2014년 2월 13일
편집: per isakson 2014년 2월 13일
Dimension of left and right hand side must agree for existing variables(??)
Show a line, which causes this error.
The Mathworks server is choked?

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

Tom
2014년 2월 13일

편집:

2014년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by