[Scilab-users] surf and %nan
sgougeon at free.fr
sgougeon at free.fr
Tue Nov 21 20:40:38 CET 2017
>It is not the most compact form but I think there is no issue with original syntax proposed:
>[a,b]=find(M==-999);
>M(a,b) = %nan;
In the M(a,b) syntax, a stands for the indices of selected ROWS, and b for the vector of selected COLUMNS, no matter about the fact that a and b have here the same length and then could be -- erroneously -- considered as respective elementwise indices.
This is why linearized indices must be used, as returned by i = find(..).
--> m = int8(grand(5,5,"uin",0,9))
m =
2 1 5 0 9
2 9 5 9 9
4 5 0 4 3
5 8 6 7 9
4 3 9 6 6
--> m([2 3 5],[1 2 4])
ans =
2 9 9
4 5 4
4 3 6
--> m([2 3 5]',[1 2 4]')
ans =
2 9 9
4 5 4
4 3 6
BR
More information about the users
mailing list