Created
March 16, 2015 18:15
-
-
Save chappjc/bd440ae2922f91082f04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function out = rld_cumsum(vals,runlens) | |
% gnovice's solution to run-length-decoding | |
% (http://stackoverflow.com/a/1975835/2778484) | |
index = zeros(1,sum(runlens)); | |
index([1 cumsum(runlens(1:end-1))+1]) = 1; | |
out = vals(cumsum(index)); | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment