Function "ismember" in Simulink?

2 ビュー (過去 30 日間)
Leo Müller
Leo Müller 2015 年 11 月 28 日
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!!!!

回答 (0 件)

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by