MATLAB: Find the name of last inport in sub-system

find_systemget_paraminport

Is there any way to get the name of last inport in sub-system using matlab code?

Best Answer

find_system(gcs, 'SearchDepth', 1, 'BlockType', 'Inport', 'Port', num2str(length(find_system(gcs, 'SearchDepth', 1, 'BlockType', 'Inport'))))
where gcs is the subsystem handle you want to search.