フィルターのクリア

issue with sum in for loop

3 ビュー (過去 30 日間)
Ram
Ram 2013 年 4 月 24 日
Hi, I have the following for loop:
for p=2:256
diff=abs(((counts2(p,2))-(counts2(p-1,2)))/(p+1-p));
disp(diff);
histsum=histsum+diff;
disp(histsum);
end
the diff is being calculated correctly but the histsum is not being calculated. It is empty hence nothing is returned for the line disp(histsum).it has been added as a variable and is initialized. Any thoughts on why this could be so and how to fix it are welcome.
thanks

採用された回答

Matt J
Matt J 2013 年 4 月 24 日
Works fine for me. Make sure you didn't initialize as
histsum=[]
  1 件のコメント
Ram
Ram 2013 年 4 月 24 日
Thanks, Matt, I had initialized it incorrectly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by