# Find doesn't seem to work with Matrix larger than 127x127

1 view (last 30 days)

Show older comments

Bartosz
on 28 Jan 2023

Commented: Walter Roberson
on 28 Jan 2023

[i,j]=find(A);

A is matrix of size n where n varies in size from 100 to 2000 (each time calculation is completed it's incremented by 50). For n = 100 all is fine, but once I reach 150 i and j only record values to 127.

If it is relevant A is matrix of adjacency for complete binary tree of n nodes

##### 5 Comments

Bruno Luong
on 28 Jan 2023

Edited: Bruno Luong
on 28 Jan 2023

FIND works just fine. Just your A matrix filling does something that you are not expected.

max(i) = 150, max(j) = 127

### Accepted Answer

Walter Roberson
on 28 Jan 2023

##### 3 Comments

Walter Roberson
on 28 Jan 2023

### More Answers (1)

Jan
on 28 Jan 2023

This observation does not match the facts:

X = randi([0, 1], 150, 150);

[i,j] = find(X);

max(i)

max(j)

If you observe a very strange behavior, which implies, that hundrets of thousands Matlab users did not notice a serious problem in standard function for many years, you can be sure, that your observation is wrong.

If no indices > 127 are found in your case, there are no non-zeros with such indices. The limit of 127 sounds like the maximum value of int8 values.

Please post some code, which reproduces the problem. I'm sure, that the proble ist not the find() command, but hidden in your code.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!