Effacer les filtres
Effacer les filtres

Function "ismember" in Simulink?

2 vues (au cours des 30 derniers jours)
Leo Müller
Leo Müller le 28 Nov 2015
Dear community,
I would like to know if there is a way to get a function like "ismember" to work in Simulink? In my program I have to find same points in an array. I have tried to create a workaround myself:
function index = find_same_points( A , B )
%create empty matrix
index_matrix = zeros(size(A,1), 3);
%comepare each row from one martix with the other
for i = 1 : size(A,1)
for j = 1 : size(B,1)
index_matrix(i,j) = A(i,1) == B(j,1)...
& A(i,2) == B(j,2)...
& A(i,3) == B(j,3);
end
end
index = any(index_matrix,2) ;
end
It always gives me the following error:
Runtime error: Index into array out of range Model Name: function_tester Block Name: function_tester/MATLAB Function Attempted to access 4 element of data index_matrix. The valid index range is 1 to 3 Please note that the simulation will be aborted immediately after you continue from this breakpoint to avoid segmentation violations.
Unfortunately I have no idea how to fix this... Please help!!!!

Réponses (0)

Catégories

En savoir plus sur Simulink Environment Customization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by