2:56
Video length is 2:56
Using ACCUMARRAY
(Originally posted on Doug's MATLAB Video Tutorials blog.)
ACCUMARRAY is one of my favorite functions that I never seem to need outside of MATLAB golf problems. I present this to you with the hopes that knowing it exists allows you to use it at just the right time. The video discusses the following code:
sales.rep = [1 2 1 3 4 6 2 3 1 1];
sales.amount = [1 1 3 1 5 2 2 4 1 5];
numReps = max(sales.rep);
sales.total = zeros(1,numReps);
for i = 1 : numel(sales.rep)
sales.total(sales.rep(i)) =...
sales.total(sales.rep(i)) + sales.amount(i);
end
sales.accum = accumarray(sales.rep', sales.amount)'
Recorded: 2 Oct 2009
Featured Product
MATLAB
Up Next:
Related Videos:
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)