how to find the smallest length filled with numbers

I need to find the column with the least amount of digits e.g 5 rows in the case below

 Accepted Answer

[~, indCol] = min(sum(~isnan(yourArray), 1));
indCol is the index for the column you need.

4 Comments

hi
That works fine, do you know how to remove all other values in the array and to make it with only 5 columns (minimum length) in this case? so to end up with a 5x19 variable
try yourArray(6:end, :) = [];
how do i combine that with indCol? coz i need it to delete the minimum column length
nevermind... figured it out thanks!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!