accumarray is a MATLAB function that is used to accumulate elements in a vector or matrix based on another vector or matrix of indices. accumarray is commonly used for calculating histograms, grouping values based on certain criteria or applying specific functions to grouped data once they are grouped with accumarray. It is currently one of the most versatile functions in MATLAB's native library and was available since MATLAB 7, R14.
Questions tagged [accumarray]
66 questions
0
votes
0 answers
Apply a function iteratively to pieces of arrays
So I have this cute pretty function which requires two input: price vector and date vector:
function [tsve, timeint, dbin,adjtsve, stringdate,rvavg,rv ] = TSVE( price,datetime )
Now I have the vectors price and datetime covering a long period…

CAPSLOCK
- 6,243
- 3
- 33
- 56
0
votes
2 answers
How to accumulate the number of appearance of an integer sequence?
I have a sequence of integers, say arr = [1,5,2,2,5,1].
I need a structure, say Counter, that can tell me how many times the integer appears.
I have the following code but it won't work since isfield cannot be used in this way.
for i = 1 :…

SolessChong
- 3,370
- 8
- 40
- 67
0
votes
1 answer
Matlab - Sum groups of elements of a vector based on given indices
I repropose a question I asked this week and that, due to a missing tag, went unnoticed (basically it was viewed only by me).
I have two large vectors, values and indices. I need to sum the elements of values using indices as in this brute force…
user2875617
0
votes
0 answers
accumarray(subs, val) where val has zeros
I have a vector vv containing market volume data for each tick, and a vector minuteIdx containing an index for different minutes. I'm using accumarray to sum the volume within each minute, like this:
orgMinuteVolumes = accumarray(minuteIdx, vv);…

siegel
- 819
- 2
- 12
- 24
0
votes
1 answer
Functions within accumarray
If I have a column of dates and a column of data, I use this code to find the cumulative sum of the data for each of the dates, as found in the third…

siegel
- 819
- 2
- 12
- 24
0
votes
0 answers
accumarray command in matlab
I want to perform a calculation that usually I am doing with a loop in the following way:
% d is a vector with size of k.
% X_ind, Z_ind is a vector with size k. %(have indexes only in the range of m*n)
% c is a vector with size k.
% each value of…

jarhead
- 1,821
- 4
- 26
- 46