How to find the index of a specific column in a matrix?
75 views (last 30 days)
Show older comments
Hi everyone,
I'm currently comparing two matrices and want to find the index of the columns in x that appear in F. I've managed to get to the point of getting the index however I want the output to be in the correct order. So, for example, if
x(:,1) = F(:,4),
x(:,2) = F(:,1),
x(:,3) = F(:,2),
x(:,4) = F(:,3),
then the output should be [4 1 2 3]. Is there a way to do this?
The F matrix I'm using is
F = [7 0 11 -10 -1 26 1000 0 0 0 1000;
1 -1 1 0 1 1 1 0 0 0 0;
0 1 -1 1 0 3 0 1 0 0 0;
1 1 -3 1 1 0 0 0 1 0 0;
1 1 0 0 0 1 0 0 0 -1 1]
and the x matrix is
x = [-10 0 7 11;
0 -1 1 1;
1 1 0 -1;
1 1 1 -3;
0 1 1 0]
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!