Mapping two matrix elements
古いコメントを表示
Hello, I have two nxm matrices A and B and want to create new nxm matrix C which elements are key:value pairs of A and B elements.
Example:
A = [1 2;
3 4];
B = [5 6;
7 8];
C = [{1: 5} {2: 6}
{3: 7} {4: 8}];
2 件のコメント
Can you rewrite your desired C result using valid matlab syntax. {1: ...} is not valid matlab syntax, so it's difficult to understand what result you want. {1, 5}, {[1, 5]}, {'1: 5'} would be valid syntax but it's not clear if it's any of these that you want.
Perhaps, you should explain what you're going to do with the result afterwards.
回答 (1 件)
the cyclist
2020 年 3 月 1 日
0 投票
1 件のコメント
Guillaume
2020 年 3 月 1 日
However, the map in matlab, just like the python dictionary is an unordered container, so I'm confused for the requirement of the output being a 2D matrix, which implies some ordering.
カテゴリ
ヘルプ センター および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!