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 回表示 (過去 30 日間)
古いコメントを表示
clc;
clear all;
close all;
chainCode =input('enter 1 & 0 string:--');
numCode = chainCode - '0' % turn to numerical array
J=find(diff([numCode(1)-1, numCode]));
z=numCode(J);
m=diff([J, numel(numCode)+1]);
rle=[];
for i=1:length(m)
rle=[rle m(i) z(i)];
end
final=num2str(rle)
1 件のコメント
Rik
2018 年 11 月 1 日
Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!