Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
1 answer
233 views

Vectorizing matrix operation instead of for loop in circular matrices

I have a vector \$X_k\$ and a matrix \$Y_{k,j}\$, where \$k \in \{1,\dots,K\}\$ and \$j \in \{1, \dots, J\}\$. They are circular, meaning that $$\eqalign{X_{k+K} &= X_k \\ Y_{k+K,j} &= Y_{k,j} ...
Xbel's user avatar
  • 197
1 vote
1 answer
140 views

Horizontally concatenating the entries of two matrices, and padding with NaNs

I have two matrices a and b that have, on each line, some values (null or not) and then a bunch of zeros at the end. I want to ...
shamalaia's user avatar
  • 294
5 votes
2 answers
98 views

Extract the largest value for each day from a matrix

I have a matrix in which the right-most elements are repeated YYYYMMDD dates in descending order, for example: ...
Stewie Griffin's user avatar
1 vote
1 answer
127 views

Merging two square matrices

I would like to optimize a snippet of code, which uses a multiple nested if statements. I am looking for a formula to make it as a combination of multiple arrays ...
user avatar
2 votes
1 answer
434 views

Optimize matlab triple for loop

I have a large matrix samples, I want to make another matrix sampleProb which is the same size, but modified as below: ...
texasflood's user avatar
3 votes
1 answer
87 views

Fast counting of interactions between groups given users interactions and groups assignments

Given: An array c that contains the group assignment of every user (c[i]=4 indicates that user i belongs to group 4) A matrix ...
alberto's user avatar
  • 235