mapping matrix of two vectors
6 ビュー (過去 30 日間)
古いコメントを表示
Hi,
If I have two vectors
and
as shown below. Is there a way to create matrix
that mapps each row of A with its correspondent in B? In other words, check row by row of both A and B. Row 1 in A has the value of 1 and corresponds to value of 3 in B, then put one, otherwise put zero.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955795/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955800/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955805/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955810/image.png)
Thanks.
0 件のコメント
採用された回答
Davide Masiello
2022 年 4 月 7 日
clear,clc
A = [1;2;3;4];
B = [3;1;4;2];
C = A == B'
1 件のコメント
Rajiuddin Sk
2023 年 2 月 1 日
Dear Davide,
When the matrix A and B contains symbols, then MATLAB could not find the transformation matrix in above mention method. Can you say how to find the transformation matrix in case of symbolic matrix?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!