I need guidance using logical indexing in a MATLAB function block in simulink. I simply want to select rows from the A matrix based on which elements of colomn one of the matrix is greater than a certain number. For example, input_matrix = [2 1 3; 1 4 2; 4 1 6], i want to use logical indexing to select rows of input_matrix where colomn 1 element is greater or equal to 2.

In matlab this would work just fine like this:

`C = input_matrix(:,1) >= 2; %logical indexing of first colomn`

output_matrix = input_matrix(C,:);

And output_matrix would be [2 1 3; 4 1 6];

However i get a variable size error when i put this in a MATLAB function block in simulink.

Thanks for your help.

## Best Answer