I just search the following related discussions:
However, they are not what I want exactly.
v = [1 0]; u = [0 1];
C = {v, u; u, u+u}
I create a cell C above with each element a row vector.
If I do
C{2,2}
it shows
ans =
0 2
Inversely, if I know [0 2], I want to find where it is, i.e., I want to get {2,2}, how could I do?
For the scalar case, the answer is shown in the second link; however, I cannot find the answer for the vector case so far.
Thanks!
Following this answer you linked to you can do :
found = cellfun(@(c) isequal(c,[0 2]),c)
which outputs
found =
2×2 logical array
0 0
0 1
lastly to get the coordinates you would use find
:
[row,col] = find(found==1)
The output will be
row = 2
col = 2