Syntax
[i,CIL]=findchangerow(c)
Input Parameter
c : | | list of succeeding rows |
Output Parameter
i : | | index list |
CIL : | | Change index list |
Examples
[a,b]=findchangerow([1 2 3 4 5 5 6 1]')
Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is designed to identify changes in a list of succeeding rows. It returns an index list and a change index list, indicating where changes occur between consecutive rows.
Input Parameters
- c: A list of succeeding rows. It is a matrix where each row is compared to its predecessor to detect changes.
Output Results
- i: A logical index list indicating where changes occur between consecutive rows.
- CIL: A change index list that provides the indices of the rows where changes occur.
Algorithm Steps
- Determine the number of rows
n
in the input matrix c
.
- Initialize a logical array
i
of size n
with false
values.
- Create a circularly shifted version of
c
called cc
, which shifts the rows by one position.
- Iterate over each row
k
from 1 to n
:
- Compare the current row
c(k,:)
with the shifted row cc(k,:)
.
- If they are not equal, set
i(k)
to true
.
- Find the indices
a
where i
is true
.
- Calculate the change index list
CIL
using the indices a
and the function mod1
to handle circular indexing.
- If
CIL
is empty, set CIL
to [1 n]
to indicate no changes.
This algorithm is useful for detecting changes in sequences of data, such as time series or ordered lists, where identifying transitions or differences is important.
Algorithm explaination created using ChatGPT on 2025-08-18 22:55. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21