MATLAB Answers

The following is a RLE code that found online and some part of it I added but couldn't understand the 6th,7th,8th line of code ,What is the diff part doing in this code?

1 view (last 30 days)
Sumeet Badgujar
Sumeet Badgujar on 1 Nov 2018
Edited: Sumeet Badgujar on 1 Nov 2018
clear all;
close all;
chainCode =input('enter 1 & 0 string:--');
numCode = chainCode - '0' % turn to numerical array
J=find(diff([numCode(1)-1, numCode]));
m=diff([J, numel(numCode)+1]);
for i=1:length(m)
rle=[rle m(i) z(i)];

Answers (0)

Community Treasure Hunt

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

Start Hunting!