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 件のコメント

Guillaume
Guillaume 2014 年 9 月 6 日
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 ExchangeCreating 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