Detect changed value in an array

10 次查看(过去 30 天)
Praveen Choudhury
Praveen Choudhury 2016-2-22
回答: goerk 2016-2-22
I have an array of m*1 size. I want to detect the changes in the values in the array. Is there some function like ischanged in simulink? Or can anyone tell me how to do it.

回答(1 个)

goerk
goerk 2016-2-22
You can simply compare a copy of the original vector with the actual vector.
A = [1 ;2; 3];
B=A;
B(1)=5; % change the array
changedMask = A~=B

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by