I'm not sure what there is to explain.As documented,col tells you where each element corresponding element ofC is found inS. If the element ofC is found in more than one position, you'll get the first one of these.
The code is also flawed and will error if any element ofC is not found at all inS. The safe version of the code would be:
S = [1 3 0 2 0 0];
C = [0 2 4]; %note that the original code would error because 4 is not present is S
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.